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

Sandro Mani manisandro at gmail.com
Tue Jul 4 08:05:30 PDT 2017


Hi

I'm doing work on the geometry checker in QGIS master and noticed that, 
when deleting features from an ogr vector layer, FeatureIds appear to be 
reassigned to fill up the gap in the ids. This is a pretty serious 
blocker for the geometry checker since geometry checker errors are 
identified by the feature id (and other parameters). So if the 
FeatureIds change, the geometry checker errors may suddenly reference 
the wrong feature, causing general mayhem.

Can anyone confirm that indeed FeatureIds are being purposefully 
reassigned, and whether there is a rationale behind this change (I never 
observed this before in QGIS 2.x)? And if so, what other options exist 
to reliably reference a feature over the entire lifetime of the layer 
being loaded in QGIS?

Note that in the geometry checker, I don't use the edit buffer, but 
write each change directly to the data provider. This to avoid that 
situations where, after fixing multiple errors, the final result cannot 
be committed due to a particular geometry still being invalid and the 
provider refusing to accept the change.

Thanks
Sandro



More information about the QGIS-Developer mailing list