PR #975 - OGR Stop using GetFID - fix for #974

This commit is contained in:
Denis Rykov
2022-09-06 13:12:20 +02:00
committed by GitHub
parent da3ce7a988
commit 42a419299b
+9 -4
View File
@@ -472,10 +472,15 @@ class OGRProvider(BaseProvider):
if skip_geometry:
json_feature['geometry'] = None
try:
json_feature['id'] = json_feature['properties'].pop(self.id_field)
except Exception as err:
LOGGER.error(err)
json_feature['id'] = ogr_feature.GetFID()
json_feature['id'] = json_feature['properties'].pop(
self.id_field, json_feature['id']
)
except KeyError as err:
LOGGER.error(
"Cannot use configured id_field nor fid as id, err={}".format(
err
)
)
return json_feature