@@ -231,7 +231,7 @@ def detection_features_to_geojson(feature_list: list) -> dict:
231231 if "image" in feature
232232 else {},
233233 # Property list
234- "properties " : {
234+ "possible_none_properties " : {
235235 # Only if "image" was specified in the `fields` of the endpoint, else None
236236 "image_id" : feature ["image" ]["id" ]
237237 if "image" in "feature"
@@ -249,6 +249,7 @@ def detection_features_to_geojson(feature_list: list) -> dict:
249249 # "id" is always available in the response
250250 "id" : feature ["id" ],
251251 },
252+ "properties" : {},
252253 }
253254 # Going through the given of features
254255 for feature in feature_list
@@ -261,13 +262,17 @@ def detection_features_to_geojson(feature_list: list) -> dict:
261262 for _feature in resulting_geojson ["features" ]:
262263
263264 # Going through each property in the feature
264- for key , value in _feature ["properties " ].items ():
265+ for key , value in _feature ["possible_none_properties " ].items ():
265266
266- # If the _property has defaulted to None
267- if value is None :
267+ # If the _property is not None
268+ if value is not None :
268269
269- # Delete the _property from the feature
270- del _feature ["properties" ][key ]
270+ # Add that property to the _feature
271+ _feature ["properties" ][key ] = value
272+
273+ for _feature in resulting_geojson ["features" ]:
274+
275+ del _feature ["possible_none_properties" ]
271276
272277 # Finally return the output
273278 return resulting_geojson
0 commit comments