Skip to content

[Bug Report] Detections with map feature ID decoding error #176

Description

@sam7676

Describe the bug
Running interface.get_detections_with_map_feature_id under select map feature IDs throws a KeyError within the models/geojson file.

To Reproduce
mapillary.interface.get_detections_with_map_feature_id(1852672618623383, fields=[])

Returns KeyError as following:

Traceback (mostrecentcalllast):
File"x.py", line703, in<module>mapillary.interface.get_detections_with_map_feature_id(1852672618623383, fields=[])
File"..\mapillary\utils\auth.py", line59, inwrapperreturnf(*args, **kwargs)
File"..\mapillary\interface.py", line330, inget_detections_with_map_feature_idreturndetection.get_map_feature_detections_controller(
File"..\mapillary\controller\detection.py", line83, inget_map_feature_detections_controllerreturnGeoJSON(
File"..\mapillary\models\geojson.py", line398, in__init__
[Feature(feature=feature) forfeatureingeojson["features"]]
File"..\mapillary\models\geojson.py", line398, in<listcomp>
[Feature(feature=feature) forfeatureingeojson["features"]]
File"..\mapillary\models\geojson.py", line270, in__init__self.geometry=Geometry(feature["geometry"])
File"..\mapillary\models\geojson.py", line211, in__init__self.type: str=geometry["type"]
KeyError: 'type'

The returned GeoJSON from the API is in the form:

[{'geometry': {'coordinates': [-0.12497729285872, 51.537085937084],
'type': 'Point'},
'properties': {'created_at': '2025-08-02T16:21:25+0000',
'id': '1724058414915752',
'pixel_geometry': 'Gjp4AgoGbXB5LW9yKIAgEisYAwgBIiUJqiuWInoIDxAABAcIAAQHBgAcAAgIBAgACAMQCwAPCCkKBxEP',
'value': 'object--catch-basin'},
'type': 'Feature'},
{'geometry': {'coordinates': [-0.12498136837391, 51.537059028201],
'type': 'Point'},
'properties': {'created_at': '2025-08-02T16:20:30+0000',
'id': '1807913776455018',
'pixel_geometry': 'Gld4AgoGbXB5LW9yKIAgEkgYAwgBIkIJ2inOJ+oBKDcEAAgHLiEkEAgKBAAECAQACAgKCAwICAgIEAsaGRALGAcIAwgHCAcIAwADCAsAGQ8DBy8fAwcTBw8=',
'value': 'object--catch-basin'},
'type': 'Feature'},
{'geometry': {},
'properties': {'created_at': '2025-08-02T16:20:20+0000',
'id': '685612757857124',
'pixel_geometry': 'GosBeAIKBm1weS1vciiAIBJ8GAMIASJ2Cd44jCy6AwQHCAAIBwgABAcGAAgHBAAIBwgABAcUCQQHCAAEBwgABAcOAAgAFAgECAgACAgICgQABAgEAAoIBAgECAgQABADEgcAAwgNAA8YBwgHCAcIAwAHCA8QFQoDACchAw8LAAMHAwAJBwsXBwADCQMHDw==',
'value': 'object--catch-basin'},
'type': 'Feature'},
{'geometry': {'coordinates': [-0.12497321734354, 51.537112845968],
'type': 'Point'},
'properties': {'created_at': '2025-08-02T16:21:33+0000',
'id': '1777805250267304',
'pixel_geometry': 'GiR4AgoGbXB5LW9yKIAgEhUYAwgBIg8JtCWiIyIyAAQYMQADBw8=',
'value': 'object--catch-basin'},
'type': 'Feature'}]

Clearly we see features in Mapillary without attached geometry, but still picked up by the map feature API.
It's unclear what the expected behaviour is here, otherwise I would have submitted a PR. 😥

Expected behavior
Detections returned as usual.
Unclear how to handle detections without any geometry.

Screenshots

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions