16

I am trying to display certain features in a shapefile-based layer using QGIS. I have found the subset function in the properties panel, which does exactly what i want, but is too tedious given that I have to manually sift through a large number of features. Is there a quicker way to do this?

I am using both shapefiles and postGIS best, dietmar

2 Answers 2

14

In QGIS you should be able to filter your data with an SQL expression in the Query Builder dialog. Just right click your layer in the table of contents and select "Query" ("Filter..." in the more recent versions).

1
  • 8
    In recent versions the dialog option "Query" has been renamed to "Filter..."
    – the_skua
    Nov 29, 2016 at 17:02
5

Tested on QGIS 3.10.2-A Coruna

How to apply a filter
* Right-click on the layer listed in panel Layers
* Choose Filter...
* The window Query Builder is displayed

How to build a query in Query Builder
* Double click on a field in Fields list
* Select All in Values
* Choose a operator from Operators
* Double click on a value in Values list
* Your expression is shown at the bottom of the window
* Click Test to have a preview of how many rows are returned
* Click OK to apply the filter
* The layer is displayed according to the filter applied (you see a filter icon aside the layer name in panel Layers)

3
  • 2
    I regularly use the Filter feature in QGIS. However in a new project I have just started, I have layers where there is no Filter option available, and the Layer > Filter menu option is greyed out. Does anyone know why a certain layer might not be filterable? I have not come across this before. Apr 12, 2021 at 18:38
  • @FrancisBarton, in my case I had to disable editing.
    – jiggzson
    Apr 13, 2021 at 15:20
  • In my case, the "toggle editing" menu item is greyed out, and the entire Edit menu is similarly greyed out and unavailable. Apr 13, 2021 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.