Skip to content

Commit b86a675

Browse files
committed
filtering features
1 parent 30faab7 commit b86a675

15 files changed

Lines changed: 59 additions & 14 deletions

src/field/filtering/index.md

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,70 @@ description: Add custom filters to sort and display only those features that you
77

88
Custom filters can be added to the <MobileAppNameShort /> to easily filter features displayed on the map as well as in the [survey layers](../layers/#browsing-features).
99

10-
## Enable features filtering
11-
Features filtering needs to be enabled in QGIS
10+
## Enable and define filtering in QGIS
11+
Filters can be enabled and defined in QGIS in **Project Properties**.
1212

13-
1. Open your <MainPlatformName /> project in QGIS and navigate to **Project** > **Properties**
13+
::: tip Plugin upgrade
14+
If you do not see the **Filtering** option in the **Project properties**, check for [plugin upgrades](../../setup/install-mergin-maps-plugin-for-qgis/#plugin-upgrade).
15+
:::
1416

15-
2. In the <MainPlatformName /> tab, check the **Enable map sketching** option.
17+
Check the :heavy_check_mark: **Enable filtering** option in the <MainPlatformName /> tab, click on the **Add filter** button and select a filter type from the list. The list of available [filter types](#filter-types) and their properties can be found below.
1618

17-
::: tip Plugin upgrade
18-
If you do not see this option in the **Project properties**, check for [plugin upgrades](../../setup/install-mergin-maps-plugin-for-qgis/#plugin-upgrade).
19-
:::
20-
21-
3. Click on the **Add filter** button and select a filter type from the list.
22-
![Enable map sketching in QGIS Mergin Maps project](./qgis-project-properties-enable-filtering.webp "Enable map sketching in QGIS Mergin Maps project")
23-
24-
4. Define the filter:
25-
- **Type**
19+
Then, define the filter:
20+
- **Type** - the filter type (in general, it should match the widget type of the filtered field)
21+
- **Layer** - choose from the project's layers
22+
- **Field** - choose from the fields of the layer. Only fields with data types compatible with the selected filter type are offered.
23+
- **Title** - the name of the filter, which will be displayed in the <MobileAppNameShort />
2624

27-
5. Save the changes and synchronise your project
25+
![Filtering in QGIS Mergin Maps project](./qgis-project-properties-enable-filtering.webp "Filtering in QGIS Mergin Maps project")
26+
27+
You can add as many filters as you need by using the **Add filter** button.
28+
29+
The order of filters can be changed by selecting a filter and using the **Up** and **Down** buttons. To remove a filter, select it and click the **Remove** button.
30+
![Filtering in QGIS Mergin Maps project](./qgis-filtering.webp "Filtering in QGIS Mergin Maps project")
31+
32+
qgis-filtering.webp
33+
Don't forget to save your project and synchronise changes so that you can use the filters in the <MobileAppNameShort />.
34+
35+
36+
### Filter types
37+
38+
**Text** filter uses simple text input. Results are filtered based the SQL expression `"field" ILIKE '%input%'`. Available for text and number field types.
39+
40+
**Number** filter provides *from* and *to* number inputs. Results are filtered based on SQL expression `"field" >= 'input_from' AND "field" <= 'input_to'`. Available for text and number field types.
41+
42+
**Date** filter provides *from* and *to* date (calendar) inputs. Results are filtered based on SQL expression `"field" >= 'input_from' AND "field" <= 'input_to'`. Available for date field types configured with the [Date and time widget](../../layer/date-time/).
43+
44+
**Boolean** filter provides a toggle between *all*, *true* and *false* values. Results are filtered based on SQL expression `"field" == 'input'`. Available for Boolean, text and integer field types configured with the [Checkbox widget](../../layer/checkbox/).
2845

46+
**Single select** filter provides a drop-down menu of field values. One value can be selected at once. The results are filtered based on SQL expression `"field" == 'input'`. Available for text and number field types configured with the [Value map or Value relation widget](../../layer/value-select/).
2947

48+
**Multi select** filter provides a drop-down menu of field values. Multiple values can be selected at once. The results are filtered based on SQL expression `"field" IN ('input')`. Available for text and number field types configured with the [Value map or Value relation widget](../../layer/value-select/#value-relation).
49+
50+
In the <MobileAppNameShort />, the filter types looks as follows:
51+
52+
![Filter types in Mergin Maps mobile app](./mobile-filter-types.webp "Filter types in Mergin Maps mobile app")
3053

3154
## Filtering features in the mobile app
55+
Filters defined in [<MainPlatformName /> project in QGIS](#enable-and-define-filtering-in-qgis) can be used in the <MobileAppNameShort />. You can filter features across multiple layers by entering or selecting values in corresponding filters. The filtering affects both the map display and the feature browsing list.
56+
57+
:::warning Filters reset
58+
Filters are reset when the project is synced. Also, they do not stay saved when the app is restarted.
59+
:::
60+
61+
Here is an example of how filtering works:
62+
63+
1. Tap the **Filters** button to open filters defined in the project
64+
![Filtering button in Mergin Maps mobile app](./mobile-open-filters.webp "Filtering button in Mergin Maps mobile app")
65+
66+
2. Enter or select values in the filters. Here, we will use a *Single select* filter on the *trees* layer and select a *tree species* value from the list.
67+
68+
You can use more filters at once.
69+
70+
Tap on the **Apply filters** button to confirm the filtering.
71+
![Filtering in Mergin Maps mobile app](./mobile-filter-single-selection.webp "Filtering in Mergin Maps mobile app")
72+
73+
3. With active filters, only features that match the criteria are displayed on the map as well as when [browsing features](../layers/#layers-legend-and-features).
74+
75+
If filters are applied
76+
![Active filter in Mergin Maps mobile app](./mobile-filtered-features.webp "Active filter in Mergin Maps mobile app")
44.9 KB
Loading
1.45 MB
Binary file not shown.
36.6 KB
Loading
656 KB
Binary file not shown.
24.4 KB
Loading
374 KB
Binary file not shown.
66.2 KB
Loading
1.59 MB
Binary file not shown.
66.4 KB
Loading

0 commit comments

Comments
 (0)