Skip to content

Commit a8152c7

Browse files
authored
Iss 750 filtering (#754)
* filtering features * filtering features * fix * feature filtering update * add filtering to mobile ui page
1 parent 7a14850 commit a8152c7

27 files changed

Lines changed: 95 additions & 6 deletions

src/.vitepress/sidebar/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export default {
111111
{ text: 'Synchronisation in Mergin Maps Mobile App', link: '/field/autosync/' },
112112
{ text: 'Measurement Tools', link: '/field/measure/' },
113113
{ text: 'Layers in Mergin Maps Mobile App', link: '/field/layers/' },
114+
{ text: 'Feature Filtering', link: '/field/filtering/' },
114115
{ text: 'Map Sketching', link: '/field/map-sketching/' },
115116
{ text: 'Photo Sketching', link: '/field/photo-sketching/' },
116117
{ text: 'How to Add, Edit, Delete Features', link: '/field/mobile-features/' },

src/field/filtering/index.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
description: Add custom filters to sort and display only those features that you need during your field survey.
3+
---
4+
5+
# Feature Filtering in Mergin Maps Mobile App
6+
[[toc]]
7+
8+
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).
9+
10+
::: tip Feature filtering blog
11+
You can read about this feature also on our blog <MainDomainNameLink id="blog/from-wishlist-to-app-feature-filtering-is-live" desc="From wishlist to app: Feature filtering is live"/>.
12+
:::
13+
14+
## Enable and define filtering in QGIS
15+
Filters can be enabled and defined in QGIS in **Project Properties**.
16+
17+
::: tip Plugin upgrade
18+
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).
19+
:::
20+
21+
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.
22+
23+
Then, define the filter:
24+
- **Type** - the filter type (in general, it should match the widget type of the filtered field)
25+
- **Layer** - choose from the project's layers
26+
- **Field** - choose from the fields of the layer. Only fields with data types compatible with the selected filter type are offered.
27+
- **Title** - the name of the filter, which will be displayed in the <MobileAppNameShort />
28+
29+
![Filtering in QGIS Mergin Maps project](./qgis-project-properties-enable-filtering.webp "Filtering in QGIS Mergin Maps project")
30+
31+
You can add as many filters as you need by using the **Add filter** button.
32+
33+
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.
34+
![Filtering in QGIS Mergin Maps project](./qgis-filtering.webp "Filtering in QGIS Mergin Maps project")
35+
36+
Don't forget to save your project and synchronise changes so that you can use the filters in the <MobileAppNameShort />.
37+
38+
39+
### Filter types
40+
41+
**Text** filter uses simple text input. Results are filtered based on the SQL expression `"field" ILIKE '%input%'`. Available for text and number field types.
42+
43+
**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.
44+
45+
**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/).
46+
47+
**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/).
48+
49+
**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/).
50+
51+
**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).
52+
53+
In the <MobileAppNameShort />, the filter types looks as follows:
54+
55+
![Filter types in Mergin Maps mobile app](./mobile-filter-types.webp "Filter types in Mergin Maps mobile app")
56+
57+
## Filtering features in the mobile app
58+
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.
59+
60+
Filters do not stay saved when the app is restarted.
61+
62+
Here is an example of how filtering works:
63+
64+
1. Tap the **More** button to open **Filters** defined in the project
65+
66+
Filtering has to be enabled in the [QGIS project](#enable-and-define-filtering-in-qgis), otherwise this option is not displayed.
67+
![Filtering button in Mergin Maps mobile app](./mobile-open-filters.webp "Filtering button in Mergin Maps mobile app")
68+
69+
2. Enter or select values in the filters. You can use more filters at once.
70+
71+
Here, we will use a *Single select* filter on the *trees* layer and select a *tree species* value from the list.
72+
73+
Tap on the **Apply filters** button to confirm the filtering.
74+
![Filtering in Mergin Maps mobile app](./mobile-filter-single-selection.webp "Filtering in Mergin Maps mobile app")
75+
76+
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).
77+
78+
You can use the active **Filters** button to quickly access filters.
79+
![Active filter in Mergin Maps mobile app](./mobile-filtered-features.webp "Active filter in Mergin Maps mobile app")
36.6 KB
Loading
656 KB
Binary file not shown.
24.4 KB
Loading
374 KB
Binary file not shown.
67.1 KB
Loading
1.6 MB
Binary file not shown.
1.09 MB
Loading
68.8 KB
Loading

0 commit comments

Comments
 (0)