When I queried some features using QgsFeatureRequest().setFilterExpression() in pyqgis,I want to make the current layer just only show what I queried without creating a new memory layer. Just like you right click on a layer in qgis and filter features you want,the layer will be changed and no new layer will be created.So what should I do? Or is there any other ways without using QgsFeatureRequest().setFilterExpression().
If I understand the question, it's something like:
layer = iface.activeLayer()
layer.setSubsetString('"field"=\'spam\'')
-
-
Sorry. I didn't see this. I only saw the vote option. I voted for your answer. But the system told me my reputation is not enough. I only got 6. Anyway,thanks again for your help. – Guoooo Mar 30 '18 at 1:51