Entity filtering
Ni Co
8- For symbology with filter (and hide entities that are not equal to the value entered in the “my filter” layer) add a third “+” rule and check “filter” then write:
attribute (get_feature ('FILTER', 'id',1), 'my filter') IS NOT NULL AND “name"<>attribute (get_feature ('FILTER', 'id',1), 'my filter')
and put the symbology: fill and line in transparent.
TO FILTER THE DISPLAY OF LABELS (if you want to show labels)
1- Click on the symbol to write a formula and fill in as follows:
CASE
WHEN
“name"=attribute (get_feature ('FILTER', 'id',1), 'my filter')
THEN “name”
WHEN attribute (get_feature ('FILTER', 'id',1), 'id',1), 'my filter') IS NULL OR attribute ('FILTER', 'id',1), 'my filter') =”
THEN “name”
END
IN QFIELD
TO APPLY THE FILTER
1- press on your screen and select “my filter” the entity “1"
2- go into input mode via the A with the pencil, enter the name you want to filter then validate
3- zoom in or out and only your filtered entities will be visible
TO REMOVE THE FILTER
1- press on your screen and select “my filter” the entity “your text”
2- switch to input mode via the A with the pencil, delete the text then validate
3- zoom in or out and all your entities will be visible
Ni Co
6- For symbology without filters and a “normal” display of all entities add a “+” rule and check “filter” then write:
attribute (get_feature ('FILTER', 'id',1), 'my filter') IS NULL OR attribute ('FILTER', 'id',1), 'my filter') =”
and define the symbology you want to see when there is no filter.
7- For symbology with filter (color display of filtered entities) add a second “+” rule and check “filter” then write:
“name"=attribute (get_feature ('FILTER', 'id',1), 'my filter')
and for filling choose, for example, the color red.
For better visibility of your entities you can add symbology by point geometry generator and define the visibility scale in the symbology and choose the symbol you want.
To be written in the geometry generator:
CASE
WHEN “name"=attribute (get_feature ('FILTER', 'id',1), 'my filter')
THEN centroid ($geometry)
END
Ni Co
TO FILTER POLYGONS
1- create a new polygon shapefile layer (for example, name this layer: FILTER)
2- in this layer (FILTER), create a polygon that covers all the entities in the IDENTITY layer (this will allow you to fill in the filter wherever you are on your map)
3- in this “FILTER” layer, add an editable text field (for example: “my filter”)
and create a form containing the “my filter” and “id” fields
4- switch the “FILTER” layer to edit mode and fill in the “id” field to 1, save then go back to the “FILTER” layer settings and remove “id” from the form
5- in the layer you want to filter (IDENTITY), go to symbology and define “by rule set”
Ni Co
Hi,
Here's how to filter in QFIELD.
For the example, I have a polygon layer named IDENTITY in which there is a “name” attribute field.
I want to filter this IDENTITY layer according to the value of the “name” attribute field.
To make this possible (to be adapted with your layer names and fields):