zonalstats = qgis.analysis.QgsZonalStatistics(vectorlayer,rasterfile) zonalstats.calculateStatistics(None) calculates by default just Count, Sum and Mean (as you can tell from `Raster -> Zonal Statistics` in QGIS Desktop, it can do a lot more). If you, for instance, want to compute just the Mean you have to use: zonalstats = qgis.analysis.QgsZonalStatistics(vectorlayer, rasterfile, QgsZonalStatistics.Mean()) zonalstats.calculateStatistics(None) see [API][1] for all options. [1]: http://qgis.org/api/classQgsZonalStatistics.html#details "API"