[GIS] QGis Zonal Statistics Plugin NoData included in Calculations

pyqgispythonqgisstatisticszonal statistics

I have been trying to use the QGIS zonal statistics plugin. My raster has a nodata value of -99999 and all other values are positive. After computing the mean zonal statistics there are a number of features that have a negative mean indicating that the Zonal Stats plugin must be included nodata values in the calculations. Is there a workaround for this or am I doing something wrong:

from qgis.analysis import QgsZonalStatistics
vectorLayer = qgis.utils.iface.activeLayer()
rasterLayer = "path/to/my/raster/et_30.tif"
prefix = 'Test'
zoneStat = QgsZonalStatistics(vectorLayer, rasterLayer,prefix)
zoneStat.calculateStatistics(None)

Best Answer

It's not your fault. Here's the ticket for this issue: http://hub.qgis.org/issues/9349

Related Question