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. Anyway, don't ant to stress it more. I will open the ticket for a flag on QGIS.
giovanni [1] "Use the FID of the source features instead of letting the output driver to automatically assign a new one" 2017-10-10 12:26 GMT+02:00 Even Rouault <even.roua...@spatialys.com>: > On mardi 10 octobre 2017 12:20:48 CEST G. Allegri wrote: > > > On second thought maybe this flag could be a creation option os the OGR > > > GeoJSON driver. The driver writes the "id" property only if a FID is set. > > > Maybe a SET_ID flag (or something more miningful) could force the driver > > > creating the "id" with a sequential integer even if a FID is not set for > > > the features. > > > What's your opinion? In case I will open a ticket for OGR. > > > > I don't think this control should be done at the driver level. I'd say > that if the GeoJSON CreateFeature() API is called with a feature with a FID > set, it should write it. > > The logic to decide whether you create a new sequence, re-use source FID > or don't set a FID at all belongs to the upper layers (in that case, QGIS. > or ogr2ogr which has -preserve_fid or -unsetFid flags). > > > > Even > > > > -- > > Spatialys - Geospatial professional services > > http://www.spatialys.com >
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer