I have a buffer and need to filter a multipoint layer (
QGSVectorLayer) so that I would get only features intersecting the buffer. What I've found:
This doesn't accept polygon arguments, just rectangles. I've found no polygon alternative. I don't want to decrease accuracy by converting my buffer to its MBR.
I must be using it wrong way, or perhaps it's a part of an old API which is no longer used. In the example it's applied directly on the layer, but while trying this, I get an error:
AttributeError: 'QgsVectorLayer' object has no attribute 'SetSpatialFilter'
I've found that such a function exists, but my google-fu is too weak to find detailed documentation on it or whether it's suitable for my needs. This link seems to say that it's deprecated/abandoned now, though I might have misunderstood it.
There already are few similar questions, even almost duplicates. One is basically "I did this in ArcPy, is it possible in PyQGIS?", and the only answer (in comments) is "it is possible" with no suggestion how to do it. The others provide some workarounds, either through looping and calling
intersects() or through QgsOverlayAnalyzer. Neither of these two seem to be a clean solution, so even though I will try the intersects() way, I don't consider it a solution unless someone proves that there's no better way.