I'm looking for some Python + QGIS for the following:
import processing for i in range (1,20): processing.runalg("qgis:zonalstatistics", "/folder/input/raster.tif",%i, "/folder/input/poly.shp","Var_%i",True, "/folder/output/zonalpoly_%i.shp"
The above BASH like example doesn't work, but if I substitute an integer in place of %i, the script runs correctly, so I know that the syntax is correct.
I'm a bit fuzzy on how to properly pass a variable into a string using Python and/or how to run a QGIS plugin from the built-in Python interpreter for QGIS.
Also, qgis:zonalstatistics calculates several summary statistics (mean, stddev, maximum, etc.) with no apparent means of specifying one or a few of these.
Is there a way of specifying just one, or a few?
It seems like a complete waste of processing time to calculate each if I'm only interested in one or a few measures.