Skip to content

get_image_looking_at radius kwarg does not work #163

@camerondavison

Description

@camerondavison

Describe the bug

Adding the radius kwarg to the get_image_looking_at function does not work, because the haversine library that is being used expects lat/lng but the geojson points are all in lng/lat

To Reproduce
lat=30.342599868774414
lng=-97.75155639648438
mly.get_image_looking_at(at={"lng": lng, "lat": lat}, radius=1000)

Expected behavior
it should filter the results, not blow up

  File ".../.venv/lib/python3.13/site-packages/mapillary/utils/filter.py", line 345, in haversine_dist
    haversine.haversine(coords, feature["geometry"]["coordinates"], unit=unit)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.venv/lib/python3.13/site-packages/haversine/haversine.py", line 218, in haversine
    _ensure_lat_lon(lat1, lng1)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File ".../.venv/lib/python3.13/site-packages/haversine/haversine.py", line 93, in _ensure_lat_lon
    raise ValueError(f"Latitude {lat} is out of range [-90, 90]")

mapillary version

❯ uv pip list | rg mapillary
mapillary             1.0.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions