[QGIS-Developer] Concatenating QgsFeatureRequest

matteo matteo.ghetta at gmail.com
Tue Dec 19 07:33:49 PST 2017


Hi devs,

maybe the question can sound trivial but I didn't find a solution.

Simply I would like to iterate only on selected features of a vector
layer features with an expression.

I know that the QgsFeatureRequest can be used with `setFilterExpression`
and `setFilterFids`.

Is it possible to combine them, so merging the following example in an
unique request?

exp = ''' "PH" > 7 '''
request = QgsFeatureRequest().setFilterExpression(exp)
l = [i.id() for i in vl.selectedFeatures()]
request = QgsFeatureRequest().setFilterFids(l)

for i in vl.getFeatures(request):
    ......


Thanks for all the suggestions!

Cheers

Matteo


More information about the QGIS-Developer mailing list