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

G. Allegri giohappy at gmail.com
Tue Oct 10 03:58:36 PDT 2017


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.rouault at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171010/afeb87eb/attachment-0001.html>


More information about the QGIS-Developer mailing list