Bug report #7125

QgsVectorLayer::getFeatures returns no features if ExactIntersect and NoGeometry used in QgsFeatureRequest

Added by Larry Shaffer over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:High
Assignee:Martin Dobias
Category:Data Provider
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

Description

Hi,

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 QgsVectorLayer::getFeatures's 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.

Associated revisions

History

#1 Updated by Jürgen Fischer over 6 years ago

using which provider?

#2 Updated by Larry Shaffer over 6 years ago

  • Status changed from Open to Feedback

Postgres/PostGIS

#3 Updated by Larry Shaffer over 6 years ago

Sorry, double-checked. The tested layer's source is a shapefile, not PostGIS. Will test with some others provider types.

#4 Updated by Jürgen Fischer over 6 years ago

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?

#5 Updated by Larry Shaffer over 6 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!

#6 Updated by Jürgen Fischer over 6 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF