Qfield Filter plugin

Hi,
I have build a plugin to filter features in your project.
With it you can select a layer and a field of your project and write 1 or many values to filter on this define layer field.
You can filter number or text and it is not case sensitive
It will highlight filtered geometries and hide others or show all geometries with filtered
If you longpress the plugin icon it will delete the filter.

It will be even better if someone can help me to:

  • change highlight color
  • auto-zoom to filtered geometries
  • Select field attributs (like list uniques values from existent fields)
  • and create points on filtered geometries

Thanks

6 Likes

Actually its like that


But i would like it like that

3 Likes

Really cool to see, I will try it out :slight_smile: @Mathieu_Pellerin Also nice for you to know I guess

In v0.2 of this plugin, i have found how to select field attributes (like list uniques values from existant fields)
Thanks to Heather_Hillers Demonstrations plugins

1 Like

Hey, this is fantastic, thanks for sharing with us and the broader community. I’m going to look at it more closely this week to see if there are things we can improve on the QField side of things to facilitate such a plugin.

Big thanks again!

@woupss , regarding the wish for selection color to be changed, you can use the QgsProject’s selectionColor property ( QGIS API Documentation: QgsProject Class Reference ) to do that. So for e.g. if you wanted to change it to red, you would do in your plugin:

qgisProject.selectionColor = “#ff0000”

For zooming to selected geometries, you can use the QgsVectorLayer’s boundingBoxOfSelected function, that’s invokable from within QML ( QGIS API Documentation: QgsVectorLayer Class Reference ). Just make sure you reproject the returned extent CRS to match that of your project CRS.

One possibly nice functionality here would be to open the feature list form to show the selected features. It’d be possible to do that by setting the feature list form model with the same expression you’ve used to select the features. It’d look something like this:

let form = iface.findItemByObjectName(“featureForm”); // note this will likely change to featureListForm in the next QField version`
form.model.setFeatures(layer, “your expression”); // the model here is a MultiFeatureListModel object, more details here: ``https://api.qfield.org/QField/classMultiFeatureListModel 
form.show();
1 Like

Thanks @Mathieu_Pellerin
I will try to make it better with your golden advices

@Mathieu_Pellerin i just can’t change the yellow selectionColor
But auto-zoom is active :+1:

edit:
it seems link, in first post, to repo is dead and i can’t edit first post

Big improvement
Now you need to type your search value(s) and it will show you found values in the layer field.
You can search as many values as you want.
It can easily support layer with over 300000 values with no lag
And now it will show you features list if you want.

1 Like

Thank you very much for the helpful plugin, it’s really great and works very well even with large, complex projects!

I just tested it and am very satisfied. If I may make a suggestion for improvement, it would be to make it possible to delete the filter more quickly with a single click and find all elements again, unless I haven’t figured that out yet. :slight_smile:

All the best,

Tommy from COFT SARL-S

If you press and hold the button, it removes the filter.
A single press would prevent the dialog box from opening.

1 Like

A new version is here
For a better visibility of filtered geometries, i add a points layer in the plugin, now points are created on your filtered geometries (no point on point geometries) and points are deleted when you delete your filter.

https://github.com/woupss/qfield-filter-plugin/releases/download/v1.1/qfield-filter-plugin.zip


2 Likes

@woupss , I love the ingenuity here. Do you have practical use(s) to this plugin?

@Mathieu_Pellerin, At work, we use this plugin to filter all the plots belonging to a farmer, allowing us to easily locate them on the map and go there if necessary. Sometimes we need to control all plots so it’s pratical.

And it can be extended to all types of searches to enable quick visual location.

1 Like

Glad to see this plugin exists! We’ve got a use case of operators wanting to see only features in a layer assigned to them and this is one way of achieving it.

1 Like

Very nice @woupss . Great plug in. I was just turned on to it and it very helpful.

A few questions/suggestions.

Is it possible that after I close QField and then reopen it that the filters I had previously implemented remain? I can’t seem to make that happen.

Is it possible that when I set a filter it doesn’t otherwise change the map in terms of what part of the map is shown? In other words, when I set a filter can the zoom not change and can the placement of the map not change?

When I have more than one filter enabled how can I turn off just one of the filters?

Hi David,
I will update the plugin.
On this new version, yours filter layer, field and values will remained after you reopen QField and the filter is automatically applied after project reloaded
For the zoom, input a checkbox to zoom or not on filtered geometries. By default it will zoom.

To turn off one filter value, delete it from your values list and reapply filter

https://github.com/woupss/qfield-filter-plugin/releases/download/v1.8/qfield-filter-plugin.zip

1 Like

Download v1.9

https://github.com/woupss/qfield-filter-plugin/releases/download/v1.9/qfield-filter-plugin.zip

Hi Woupss,

Your amazing! Thanks for updating the plugin. This is helpful.

With the turning off just one filter, I was referring to when I apply a filter to two different layers not two values within a layer field. I can do this, but then I can’t find a way to turn off the filter on one of the layers while leaving the filter for the other layer. It seems like I have to turn them both off. Do I have this wrong?

Best,

David

Hi,

Effectivly, this plugin filter on just one layer, it can’t have filters on 2 different layers in same time