Bug report #9151
zonal stats gives wrong results when features are not overlapped to any raster pixels
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||Yes||Copied to github as #:||17784|
Take the linked sample data and run the zonal stats tool.
The raster is 1m resolution and all pixels have value = 1.
Then the "count" and "sum" columns should have the same value.
It happens that for 5 features of the polygon layers the values of this two columns are not the same and are a bit odd.
In fact the value of this columns for those features should be "0" or "NULL" because no pixel is overlapped with them.
Tested on qgis master. I'll tag this as high priority because it returns wrong results and user may be lead to further issues.
#2 Updated by Giovanni Manghi about 6 years ago
Alexander Bruy wrote:
Dataset not available anymore. Is it possible to upload a new one?
Hi Alex, maybe I can upload it later, but anyway it is just enough to use a raster and a polygon features that just partially overlaps the raster (the rest overlaps nulls or even outside the extent of the raster).