diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-05-21 14:31:59 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-17 13:21:28 +0200 |
commit | 10f3a60ffc796a23949d51ae37d5a604da439d14 (patch) | |
tree | 58f3e611a1675c50ab6eb46cb0b27b4e2804da12 /ishtar_common/views_item.py | |
parent | e1add4422cd9801a2683b4c9f68b2e9e60a9f28a (diff) | |
download | Ishtar-10f3a60ffc796a23949d51ae37d5a604da439d14.tar.bz2 Ishtar-10f3a60ffc796a23949d51ae37d5a604da439d14.zip |
JS Map: do not display incoherent coordinates
Diffstat (limited to 'ishtar_common/views_item.py')
-rw-r--r-- | ishtar_common/views_item.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 80975eb0a..f5dedb8d5 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -1086,7 +1086,8 @@ def _format_geojson(rows, link_template): return data for row in rows: feat = {'id': row[0], 'name': row[1]} - if not row[2]: + x, y = row[2], row[3] + if not x or not y or x < -180 or x > 180 or y < -90 or y > 90: data['no-geo'].append(feat) continue feature = { @@ -1094,7 +1095,7 @@ def _format_geojson(rows, link_template): 'properties': feat, 'geometry': { u'type': u'Point', - u'coordinates': [row[2], row[3]] + u'coordinates': [x, y] } } data['features'].append(feature) |