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()
  • My pleasure to help you ;) . Could you accept my answer? – Oscar Campo Mar 29 '18 at 9:27
  • 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

Your Answer

