[GIS] Saving and exporting filters in QGIS to reuse, is that possible

filteropen-data-kitqgis

I have a project with about 40 layers imported from .csv files. Each layer is data from Open Data Kit (ODK) surveys in a specific geographic area. There are about 15 filters that people want to apply to each layer. They don't need to apply them to all layers at once. What they want to do is look at a layer, apply a filter, then perhaps compare to another layer. The filters themselves won't change. It can actually become quite tedious to add a filter, copy and paste the filter and then do same for a whole bunch of layers.

To me, an ideal situation would be to apply a filter, export the filter as a text file perhaps, and then use an import that filter, similar to what you can do with a specific style. I don't know if this is possible in QGIS.

I took a look at this question and it helps, sort of gets to what I want to do, but rather than apply a filter to multiple layers, I would like to be able to select a pre-coded filter.

Best Answer

You can add the python filters as an action. Right click on the layer, click properties and click the actions tab.

Click the + button to make a new one. Choose python as the type and use the question you linked to help you create the filter.

Your users can then select which filter to apply to the layer by clicking the action icon.

Related Question