mapillary / mapillary/mapillary-python-sdk

[Bug Report] Detections with map feature ID decoding error

Aberta
#176 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

bug
Linguagem predominante
Python
Estrelas
66
Forks
23
Merge médio
1d 20h
PRs com merge (30d)
11

Descrição

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 (most recent call last):
  File "x.py", line 703, in <module>
    mapillary.interface.get_detections_with_map_feature_id(1852672618623383, fields=[])
  File "..\mapillary\utils\auth.py", line 59, in wrapper
    return f(*args, **kwargs)
  File "..\mapillary\interface.py", line 330, in get_detections_with_map_feature_id
    return detection.get_map_feature_detections_controller(
  File "..\mapillary\controller\detection.py", line 83, in get_map_feature_detections_controller
    return GeoJSON(
  File "..\mapillary\models\geojson.py", line 398, in __init__
    [Feature(feature=feature) for feature in geojson["features"]]
  File "..\mapillary\models\geojson.py", line 398, in <listcomp>
    [Feature(feature=feature) for feature in geojson["features"]]
  File "..\mapillary\models\geojson.py", line 270, in __init__
    self.geometry = Geometry(feature["geometry"])
  File "..\mapillary\models\geojson.py", line 211, 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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Reproduza a chamada para mapillary.interface.get_detections_with_map_feature_id com fields=[] e rastreie-a por interface.py, controller/detection.py e models/geojson.py. Inspecione como Geometry lida com o objeto de geometria vazio, esclareça qual é a representação retornada pretendida e considere a issue concluída quando esta resposta não lançar mais KeyError e o comportamento esperado estiver coberto.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
api, backend
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.