I'm working with QGIS 3.22.10-Białowieża and I've got a point layer with the attribute year
. I need to create a series of heatmaps, one for each year, but I haven't found any filtering option in the heatmapkerneldensity
tool (or any other) to perform such an iteration.
Is there an automatic way of doing so?
Best Answer
You can automate the task:
Create model
Create a model I linked above with 2 inputs: point layer and numer for year to be selected. Then add
Extract by expression
algorithm. For expression, chooseyear = @year_selected
(change this to attribute name and model input name you have):Run model in batch mode
Run your model and choose batch mode. For year selected, use
Autofill...
and selectadd values by expression
. Create an array that contains all years for which you want to generate a heatmap. For years 2015 to 2022, I used:generate_series(2015,2022)
.For input point layer and heatmap (output), fill in the first row and than choose
Fill down
. When you do this for the output, you will be promted for autofill mode: selectFill with parameter values
and selectyear_selected
to get the year added to the file name: