Bug report #13081

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

Added by Tobias Klinge over 9 years ago. Updated over 7 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Analysis library
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:21149

Description

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

data.zip - Sample data (154 KB) Tobias Klinge, 2015-07-06 07:45 AM

History

#1 Updated by Giovanni Manghi over 9 years ago

  • Category set to 115
  • Priority changed from Normal to High
  • Affected QGIS version changed from 2.10.0 to master
  • Crashes QGIS or corrupts data changed from No to Yes

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

#2 Updated by Alexander Bruy almost 9 years ago

  • Tag deleted (zonal-statistics)

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.

#3 Updated by Giovanni Manghi almost 8 years ago

  • Category changed from 115 to Analysis library

#4 Updated by Giovanni Manghi almost 8 years ago

  • Target version set to Version 3.0

#5 Updated by Giovanni Manghi over 7 years ago

  • Crashes QGIS or corrupts data changed from Yes to No
  • Status changed from Open to Closed
  • Priority changed from High to Normal
  • Resolution set to worksforme

Results are correct on 2.18.4 on both Linux and Windows.

Also available in: Atom PDF