Bug report #16544

Updated by Jürgen Fischer almost 7 years ago

h1. Steps to reproduce

1. Create a vector memory layer with some features
2. Try accessing getFeatures(QgsMapRequest) in Python:
<pre>
request = QgsFeatureRequest(QgsRectangle(mapCoords, mapCoords)) # insert e. g. click coordinates here
request.setFlags(QgsFeatureRequest.ExactIntersect)
features = list(memoryLayer.getFeatures(request))
</pre>

h2. Observed behaviour

No feature is returned.

h2. Expected behaviour

The features intersecting with the given point are returned.

h1. Remarks

On layers loaded from disks, this works like a charm (you don't even need to supply the ExactIntersect flag).

An easy workaround is to not use exact feature requests, but just use normal ones and filtering manually with
<pre>
feature.geometry().contains(mapCoords)
</pre>
Something similar could probably be the fix already.

Normal requests return all features which intersect with their bounding box.

See also #16068 also: https://issues.qgis.org/issues/16068

Back