0

I'm learning QGIS and tried zonal statistics, but for some reason it gives me wrong results and I don't know why.

This red pixel contains value 1.

enter image description here

Then I create a polygon on top of it.

enter image description here

And then Zonal statistics, which gives me wrong sum and count.

Does anyone have any idea what I'm doing wrong?

enter image description here enter image description here

2
  • 3
    That means there are 16 pixels (4x4) in the red layer. Because _count=16, _sum=16, _mean=1. If this is true, you will get _count=16, _sum=32, _mean=2 if you change raster values to 2. Mar 21, 2023 at 10:40
  • I tested this with another raster pixel with value 2 and looks like you are right. Is there any way to extract/calculate raster band values with zonal statistics tool or..? I created the raster layer from vector grid layer. My goal is just to create areas/buffers and calculate values within the area they cover. Thanks!
    – Temez
    Mar 22, 2023 at 6:59

1 Answer 1

0

To your question in the comment, yes, you can choose the band of the raster in the Zonal stats tool (gives you an option to choose the band). I think you might need to run the command several times for different bands, but it is possible:

enter image description here

Also, you mention creating buffers - you can do that with a specific command from the geoprocessing toolkit around the points: Vector Geometry => Buffer:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.