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

G. Allegri giohappy at gmail.com
Tue Oct 10 03:20:48 PDT 2017


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.

giovanni

2017-10-10 12:12 GMT+02:00 G. Allegri <giohappy at gmail.com>:

> Ok, i will open a ticket to suggest the creation of a flag inside the Save
> file window.
> thanks Even.
>
> giovanni
>
> 2017-10-10 12:08 GMT+02:00 Even Rouault <even.rouault at spatialys.com>:
>
>> On mardi 10 octobre 2017 12:02:00 CEST G. Allegri wrote:
>>
>> > Hi Even,
>>
>> > I thought file writing path went through the OGR provider, while it
>> simply
>>
>> > uses QgsFileWriter.
>>
>> > Is there any reason not having OGR_F_SetFID be used? If there isn't any
>>
>> > side effect could we use it by default?
>>
>>
>>
>> Apparently
>>
>> https://github.com/qgis/QGIS/commit/891e66523fdf21283ca15533
>> 684a57dd8c27f955
>>
>> was done to avoid issues with DXF output (AFAIR, some ids are reserved by
>> the DXF template used, and if you use them for features you write, readers
>> will be confused).
>>
>>
>>
>> But besides this bug, for drivers that support assigning a FID on
>> creation, this will change their output. And I can imagine there are
>> situations where you want a "clean" sequence of ids, and others where you
>> really need to preserve the source fids. So it would make sense to have an
>> option to control whether you set or not the FID before creation.
>>
>>
>>
>> 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/e39d0ab0/attachment.html>


More information about the QGIS-Developer mailing list