“QGIS allows you to filter, sort and manipulate attribute data.”
In the table view, each row in the attribute table displays the attributes of a unique feature in the layer. Selecting a row selects the feature and likewise, selecting a feature in the map canvas (in case of geometry enabled layer) selects the row in the attribute table. If the set of features selected in the map canvas (or attribute table) is changed, then the selection is also updated in the attribute table (or map canvas) accordingly.
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?
Name | Expectation |
---|---|
First Filter field |
type |
Filter text |
Disputed |
Filter Case |
Case sensitive |
Filter Expression |
Contain |
Second Filter field |
pop_est |
Filter Value |
150000 |
Filter Expression |
Greater than |
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:
subset
filter on a layer (via the layer properties dialogue) which will hide any features (including from the attribute table) that do not match the query criteriaview
of a subset of layersYou 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
.
True or false: Applying a filter in the attribute table will result in only those features being shown on the canvas:
What is the purpose of filtering the attribute table - choose all that apply:
Why would you choose filter using form rather than the normal filtering: