Skip to content

Commit

Permalink
Dedup geojson features
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Lucey committed Sep 3, 2023
1 parent d625e4c commit 39ff7da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 12 additions & 1 deletion src/via/models/journeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 39ff7da

Please sign in to comment.