Hi,
I am trying to use the Zonal statistics tool in QGIS to extract the sum of several raster layers. I am using QGIS 3.8. It is best to use the python console as I have several raster layers. The codes which I got in some of the old discussion forums is not working. Here is an example of what I tried till now -
import glob, os, qgis.analysis vectorlayer = qgis.utils.iface.mapCanvas().currentLayer() rasterfolder = 'C:/Users/…/Folder/' os.chdir(rasterfolder) for lyr in glob.glob("*.tif"): qgis.analysis.QgsZonalStatistics(vectorlayer, lyr, attributePrefix=lyr, rasterBand=1).calculateStatistics(None)I have to do this in qgis because the class I am going to teach does not have access to ArcGIS.
Thanks,
Tilottama