Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong results using tool "Zonal Statistics" #25058

Closed
qgib opened this issue Sep 19, 2017 · 3 comments
Closed

Wrong results using tool "Zonal Statistics" #25058

qgib opened this issue Sep 19, 2017 · 3 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption High Priority Plugins

Comments

@qgib
Copy link
Contributor

qgib commented Sep 19, 2017

Author Name: Pieter Roggemans (@theroggy)
Original Redmine Issue: 17159
Affected QGIS version: 2.18.12
Redmine category:c++_plugins/zonal_statistics


The tool "Zonal statistics" gives wrong results for polygons that are (mainly) smaller than the pixels size of the raster data. In this case, the "count" value is a decimal number instead of an integer, and I don't find a logic in what the number is based on: no obvious correlation with area,....

To reproduce:

  1. On this location (https://drive.google.com/open?id=0B-lmgiUm-f0HQXFRYlBoUE9QM2s), you'll find 3 files:
  • L2A_T31UES_20170506T105031_TCI_10m_nomixels.tif: a sentinel2 TCI image where the mixels were set to 0 by using the "Rasterize" function to evade having mixels influence the results in "Zonal statistics". The Nodata value of the file is set to 0.
  • Polygons_error_zonalStatistics.zip: a shape file containing polygons that will produce count values that are not natural numbers. In most of the cases the number of pixels should have been 0, in some cases it should have been 1. The columns are already a calculation using "Zonal Statistics" on the tif file also provided.
  • Polygons_OK_zonalStatistics.zip: a shape file containing polygons that will produce count values that are correct. The "nodata" pixels are ignored, as is to be expected. The columns are already a calculation using "Zonal Statistics" on the tif file also provided.
  1. Unzip the zip files
  2. Add the above files to a project
  3. Do "Raster"/"Zonal statistics"/"Zonal statistics".
  4. Choose the tif file above, and either the "Error" shape file or the "OK" shape file + make sure you check the 'count' field.
  5. All 'count' values of the count column will be a decimal number for the 'Error' shapefile, for the 'OK' shapefile they will be integers.

Any questions are ofcourse very welcome.

@qgib
Copy link
Contributor Author

qgib commented Sep 19, 2017

Author Name: Giovanni Manghi (@gioman)


The same has been seen on master, where the tool is only available as part of the Processing toolbox.


  • category_id was changed from Rasters to C++ plugins/Zonal statistics

@qgib
Copy link
Contributor Author

qgib commented Feb 22, 2018

Author Name: Giovanni Manghi (@gioman)


  • priority_id was changed from Normal to High

@qgib
Copy link
Contributor Author

qgib commented Jun 8, 2018

Author Name: Nyall Dawson (@nyalldawson)


Applied in changeset 83d44b9.


  • done_ratio was changed from 0 to 100
  • status_id was changed from Open to Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption High Priority Plugins
Projects
None yet
Development

No branches or pull requests

1 participant