in src/mapillary/utils/format.py [0:0]
def feature_to_geojson(json_data: dict) -> dict:
"""
Converts feature into a GeoJSON, returns output
From::
>>> {'geometry': {'type': 'Point', 'coordinates': [30.003755665554, 30.985948744314]},
... 'id':'506566177256016'}
To::
>>> {'type': 'FeatureCollection', 'features': [{'type': 'Feature', 'geometry': {'type':
... 'Point','coordinates': [30.98594605922699, 30.003757307208872]}, 'properties': {}}]}
:param json_data: The feature as a JSON
:type json_data: dict
:return: The formatted GeoJSON
:rtype: dict
"""
# The geometry property will always be present
keys = [key for key in json_data.keys() if key != "geometry"]
feature = {"type": "Feature", "geometry": {}, "properties": {}}
# Make sure that all keys exist and retrieve their values if specified
for key in keys:
feature["properties"][key] = json_data[key]
return feature