QGIS Heatmap – How to Create Series of Annual Heatmaps in QGIS

batchheat mapiterationqgisqgis-modeler

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:

  1. Create a model for your workflow (find the model I created for this task here to download)
  2. Run your model in batch mode, running it once for each year you wish.

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, choose year = @year_selected (change this to attribute name and model input name you have):

enter image description here

Run model in batch mode

Run your model and choose batch mode. For year selected, use Autofill... and select add 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: select Fill with parameter values and select year_selected to get the year added to the file name:

enter image description here

enter image description here

Related Question