[QGIS-Developer] how to find all features from original data in filtered layer
Richard Duivenvoorde
rdmailings at duif.net
Mon May 15 04:25:23 PDT 2017
I have a TimeManager-handled layer, meaning a layer which has a filter
on it based on a attribute 'time'. So the layer has a subsetString.
Say, the total hour based dataset is 24 hour, so I see 1 hour at a time
(using TimeManager)
BUT now I want to select all features from the original/whole dataset
based on another attribute (usecase: select 1 feature and find others
based on the value of one attribute of that feature, and show the count
in total set).
I tried something like:
l=iface.mapCanvas().currentLayer()
request = QgsFeatureRequest()
request.disableFilter()
it = l.getFeatures( request.setFilterExpression( u'"device" =
\'NL1212\'' ) )
i=0
for f in it:
i += 1
print "{} {}".format(i, f['gml_id'])
But still I get just 1 result.
Looking into the api I found:
layer.dataProvider().featureSource().getFeatures(), but that already has
the subsetString set
Anybody a clue or workaround (loading the data a second time in a hidden
layer??)
Regards,
Richard
More information about the QGIS-Developer
mailing list