I have 4k point shapefiles, from which I would like to generate heatmap TIFFs using the QGIS heatmap plugin (or a functional equivalent featuring triweigth, radius and cell size selection). Is there any way to batch / script / automate this? I.e. "add vector shapefile, run heatmap plugin with specific options, remove vector shapefile and raster heatmap, add next vector shapefile, repeat..."?

  • If you use the Processing Toolbox -> use rightclick on the function and select batch-processing :)
    – Curlew
    Commented Mar 11, 2014 at 10:34
  • Would do - if only the heatmap plugin would be part of the processing toolbox... Commented Mar 11, 2014 at 14:11
  • A "Heatmap" is just a weighted kernel density estimation. Just look for instance at the Kernel Density Estimation tool from SAGA or one of the Grass functions
    – Curlew
    Commented Mar 11, 2014 at 14:43
  • Thats what I eventually did (see my answer below) - using grass, and conveniently shifting to the command line anyhow. Thanks for the hint though... Commented Mar 11, 2014 at 15:04

1 Answer 1


For all I figured out, it is not possible to automate the heatmap - but GRASS has triweight KDE estimates, and CAN be scripted. Here is the general setup, to be put into a BASH file:


Heatmap generation from constituency.shp to constituency.tif would be like this (at the bottom of the BASH file):

v.in.ogr -e dsn=${GRASS_DBASE_EXAMPLE}/constituency.shp output=vector_layer ty$
g.mapset mapset=PERMANENT location=vector_location
g.region res=.0001
v.kernel --verbose -o input=vector_layer kernel=triweight output=raster_layer stddeviation=0.03
r.out.gdal input=raster_layer output=constituency.tif nodata=0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.