From 10f3a60ffc796a23949d51ae37d5a604da439d14 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 21 May 2019 14:31:59 +0200 Subject: JS Map: do not display incoherent coordinates --- ishtar_common/views_item.py | 5 +++-- 1 file 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) -- cgit v1.2.3