[QGIS-Developer] set and export FID with OGR provider

Even Rouault even.rouault at spatialys.com
Tue Oct 10 04:08:51 PDT 2017


On mardi 10 octobre 2017 12:58:36 CEST G. Allegri wrote:
> Well, you almost convinced me, but for what I can see from the ogr2ogr
> docs, if -preserve-fid is not set the output driver is expected to create
> the FIDs [1]. This means that if a a FID is not set (and not preserved) the
> GeoJSON output driver should write it.

Ah the doc of -preserve_fid is not completely accurate. In the specific case of 
GeoJSON, it doesn't need to create a FID if none is provided to it, so it doesn't create 
one. But for drivers like shapefile, PG, etc... the output driver needs to assign a FID to 
the new feature.

I've just changed the doc to:
"Use the FID of the source features instead ofletting the output driver to 
automatically assign a new one (when it needs to assign a FID. Some formats, like 
GeoJSON, have optional FID)"

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171010/ff3be433/attachment.html>


More information about the QGIS-Developer mailing list