Hi,

Take this GeoJSON

{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id":12425552,
"properties":
{
},
"geometry": {
"type": "Point",
"coordinates": [26.30578223, 60.26170791]
}
}]
}

Ogrinfo knows the fid
OGRFeature(one_feature):12425552

Convert into a new GeoPackage and the native fid is lost
ogr2ogr -f gpkg one_feature.gpkg one_feature.json
OGRFeature(one_feature):1

Running the command with "-preserve_fid" keeps the native fid but according to 
ogr2ogr documentation https://gdal.org/programs/ogr2ogr.html that should not be 
needed:

"Use the FID of the source features instead of letting the output driver 
automatically assign a new one (for formats that require a FID). If not in 
append mode, this behavior is the default if the output driver has a FID layer 
creation option, in which case the name of the source FID column will be used 
and source feature IDs will be attempted to be preserved."

Is the error in the documentation or in the GeoJSON-GeoPackage conversion?

-Jukka Rahkonen-


_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to