Bug report #9151

zonal stats gives wrong results when features are not overlapped to any raster pixels

Added by Giovanni Manghi almost 11 years ago. Updated over 10 years ago.

Status:Closed
Priority:High
Assignee:Marco Hugentobler
Category:C++ Plugins
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

Description

Take the linked sample data and run the zonal stats tool.

https://www.dropbox.com/s/jb452t5e64j6m70/zs.tar.gz

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.

test-shp.zip (1.51 KB) Alexander Bruy, 2014-03-24 06:42 AM


Related issues

Related to QGIS Application - Bug report #9349: QGis Zonal Statistics Plugin NoData included in Calculations Closed 2014-01-15

History

#1 Updated by Alexander Bruy over 10 years ago

Dataset not available anymore. Is it possible to upload a new one?

#2 Updated by Giovanni Manghi over 10 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).

#3 Updated by Giovanni Manghi over 10 years ago

  • Status changed from Open to Feedback

#4 Updated by Alexander Bruy over 10 years ago

Just tested with raster from QGIS test data (tests/testdata/tenbytenraster.asc) and attached shapefile. Seems works as expected.

#5 Updated by Giovanni Manghi over 10 years ago

Alexander Bruy wrote:

Just tested with raster from QGIS test data (tests/testdata/tenbytenraster.asc) and attached shapefile. Seems works as expected.

I will try and let you know.

#6 Updated by Giovanni Manghi over 10 years ago

  • Resolution set to fixed/implemented
  • Status changed from Feedback to Closed

Also available in: Atom PDF