Bug report #7125
QgsVectorLayer::getFeatures returns no features if ExactIntersect and NoGeometry used in QgsFeatureRequest
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||16194|
Recently, I updated the Show/Hide Label tool to work with new vector API (3676a38), but it should have worked before.
I could not use
QgsFeatureRequest::ExactIntersect | QgsFeatureRequest::NoGeometry when setting the flags in the
QgsFeatureRequest or no features were returned. Setting the flags to
QgsFeatureRequest::ExactIntersect return the correct features. The call to
QgsVectorLayer::getFeatures in this instance does not need to return the geometries, as only the id is being collected from the returned features that intersect the given rectangle.
#5 Updated by Larry Shaffer almost 10 years ago
Jürgen Fischer wrote:
Larry Shaffer wrote:
Sorry, double-checked. The tested layer's source is a shapefile, not PostGIS. Will test with some others provider types.
And that yielded? Does https://gist.github.com/jef-n/4747002 work for you?
There does not seem to be any related issue with PostGIS layers. The Show/Hide Label tool works fine for those.
After applying your QgsOgrFeatureIterator fix, the shapefile layers work fine, too (tested those layers right before applying the fix and they did not work).
Thanks for your help!