From 39ff7da184ecb573d1c445b179edf9a7ec6120a3 Mon Sep 17 00:00:00 2001 From: Robert Lucey Date: Sun, 3 Sep 2023 12:32:09 +0100 Subject: [PATCH] Dedup geojson features --- setup.py | 2 +- src/via/models/journeys.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index ef466de..ae73833 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( name='via-api', - version='2.12.0', + version='2.13.0', python_requires='>=3.9', description='Analysing and serving crowdsourced road quality data', long_description='Analysing and serving crowdsourced road quality data', diff --git a/src/via/models/journeys.py b/src/via/models/journeys.py index 9f5dc27..746d70c 100644 --- a/src/via/models/journeys.py +++ b/src/via/models/journeys.py @@ -150,7 +150,18 @@ def geojson(self): "Getting geojson features of journeys group in region: %s", region_name, ) - geo_features.extend(journeys.geojson["features"]) + + geojson = journeys.geojson + + deduped = [ + i + for n, i in enumerate(geojson["features"]) + if i not in geojson["features"][n + 1 :] + ] + + # TODO: dedup by edge_id. Also find out why dups in the first place + + geo_features.extend(geojson["features"]) geo_features = {"type": "FeatureCollection", "features": geo_features} return geo_features