“QGIS allows you to filter, sort and manipulate attribute data”
Behind every vector layer in QGIS you will find a data table (attribute table). The data in this table describe the attributes of each feature. With QGIS you can manipulate the table display by filtering and sorting these attributes. You can also use queries to search for features with specific characteristics. In this exercise we will try out some of these capabilities.
Goal: To query and filter attributes
Check your results
How many records were listed once the filter was applied?
When you filter features in the attribute table, the filter only applies to the table – the map canvas will still show all the features. If you use the 'select features' button rather than the 'filter features' button, the matching rows will be selected – you can zoom to the selected features on the map or raise the selected features to the top of the table.
Once there is a table filter in place, you can easily update all the filtered features by placing the table in edit mode and using the quick formula bar. Note that, as of QGIS 2.18, you need to force a refresh of the table to see your updates applied to the table.
There are also ways to filter your layer for both geometries and attribute data in QGIS. For example, you can:
You can also use 'soft' approaches to filter features shown in the map canvas - for example using a rule-based renderer to exclude certain features from the map render.
There is another way to filter the records shown in the QGIS table view - you can limit the list of features shown to only those that are also visible in the map canvas by using the filter button on the bottom left corner of the attribute table and setting it to 'Show features visible on the map'.
Click here to download the sample data for the lesson.