Skip to content

Commit 74359d4

Browse files
authored
Update filter.py
haversine distance expects it's tuples to have latitude first and longitude second. Changing the order of the tuple results in incorrect values for the distance. I've flipped the lists from [lon, lat] to [lat, lon]
1 parent 685e8fe commit 74359d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mapillary/utils/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def haversine_dist(data: dict, radius: float, coords: list, unit: str = "m") ->
342342

343343
# If the calculated haversince distance is less than the radius ...
344344
if (
345-
haversine.haversine(coords, feature["geometry"]["coordinates"], unit=unit)
345+
haversine.haversine(coords[::-1], feature["geometry"]["coordinates"][::-1], unit=unit)
346346
< radius
347347
):
348348
# ... append to the output

0 commit comments

Comments
 (0)