qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.62k stars 3.01k forks source link

Zonal Statistics miscalculates when handling polygons without raster cells within its boundaries #21149

Closed qgib closed 5 years ago

qgib commented 9 years ago

Author Name: Tobias Klinge (Tobias Klinge) Original Redmine Issue: 13081 Affected QGIS version: master Redmine category:analysis_library


I believe the title says it all. Working with the attached sample data, Zonal Statistics ended up calculating means, medians etc. for polygons (no apparent geometry issues) that have no valid raster cells underneath. Note, however, that this does not happen all the time since some returns were indeed NULL (as they should be). One indicator for faulty results is clearly that count returns floats instead of integers. Except for this, the plugin worked fine - thanks again for expanding its options. Hopefully, this can be resolved quickly. Best regards tjk


qgib commented 9 years ago

Author Name: Giovanni Manghi (@gioman)


This is confirmed to affect the core c++ plugin, while the same tool in the Processing toolbox seems ok.


qgib commented 8 years ago

Author Name: Alexander Bruy (@alexbruy)


In fact almost all polygons in the attached dataset have raster within their boundaries, but this is NODATA value. Even plogon in the middle of the raster has wrong statistics.

And I can not reproduce this bug with clipped part of the attached raster/vector layers.


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


Results are correct on 2.18.4 on both Linux and Windows.