[QGIS-Developer] QGIS/OGR: FeatureIds reassigned on write to data provider?

Even Rouault even.rouault at spatialys.com
Tue Jul 4 09:46:05 PDT 2017


> I don't know if it would be possible for OGR - in case of a repack() -
> to create an internal map of new ids to original ids (or if it would be
> possible for people to stop using shp :P). But I really don't know the
> internals of ogr (or people) good enough to comment on the feasibility
> of such a mechanism.

One could imagine to create such a map inside the shapefile driver itself (could be RAM 
costly though) But I guess that after a repack people expect OGR to return features and 
feature ids as they would appear after a fresh new open ? And I anticipate that this game 
with remapping feature ids could cause issues. For example the feature iterator operates on 
a OGR dataset handle which is not the one of the QgsOGRProvider object, so you would get 
different ids for the same feature depending on which handle is used. That would be a 
mess...

Another solution would be to defere the compaction only at layer closing (that's actually the 
new behaviour of the OGR Shapefile driver in recent GDAL versions to force a repack at 
closing). I'm not sure why QGIS currently repacks it every time ?

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/20170704/9932bded/attachment.html>


More information about the QGIS-Developer mailing list