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 | 433a7952c6f0807b1792b023a54cf98801748fce (patch) | |
tree | 58f3e611a1675c50ab6eb46cb0b27b4e2804da12 /ishtar_common | |
parent | 921a1b7aedb097135554b7f6ae7358e37c58b704 (diff) | |
download | Ishtar-433a7952c6f0807b1792b023a54cf98801748fce.tar.bz2 Ishtar-433a7952c6f0807b1792b023a54cf98801748fce.zip |
JS Map: do not display incoherent coordinates
Diffstat (limited to 'ishtar_common')
-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) |