<div dir="ltr">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.<div>What's your opinion? In case I will open a ticket for OGR.</div><div><br></div><div>giovanni</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-10 12:12 GMT+02:00 G. Allegri <span dir="ltr"><<a href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ok, i will open a ticket to suggest the creation of a flag inside the Save file window.<div>thanks Even.</div><div><br></div><div>giovanni</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-10-10 12:08 GMT+02:00 Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div style="font-family:'monospace';font-size:9pt;font-weight:400;font-style:normal"><span>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">On mardi 10 octobre 2017 12:02:00 CEST G. Allegri wrote:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Hi Even,</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> I thought file writing path went through the OGR provider, while it simply</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> uses QgsFileWriter.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Is there any reason not having OGR_F_SetFID be used? If there isn't any</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> side effect could we use it by default?</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</span><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Apparently</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="https://github.com/qgis/QGIS/commit/891e66523fdf21283ca15533684a57dd8c27f955" target="_blank">https://github.com/qgis/QGIS/c<wbr>ommit/891e66523fdf21283ca15533<wbr>684a57dd8c27f955</a></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">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).</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">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.</p><span>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Even</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">-- </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Spatialys - Geospatial professional services</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a></p></span></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>