3

I am trying to extract zonal statistics from raster imagery using polygons in QGIS 3.2.1, but I only want to use values from those pixels that are completely included in the polygons, ¿how to do this?

Answer for the comment: I'm agree but I have a problem when I polygonize my raster. This is because similar values form bigger polygons and then I have problems to select by location because the polygon is more big than a pixel –

enter image description here

1
  • I tried with zonal stats but it takes into account the pixels that are cutted Commented Jul 27, 2018 at 14:32

1 Answer 1

3

It seems you need to clip raster to mask layer without including pixels that overlap the edge of the mask layer.

Polygonize your raster.

enter image description here

Use Select by location tool to select features in Vectorized layer that fall within the polygon layer. enter image description here enter image description here

Clip raster by mask layer using the selected features of the Vectorized layer as the mask layer. Don't crop the extent. enter image description here

enter image description here

Run Zonal Stats on the clipped raster.

1
  • I'm agree but I have a problem when I polygonize my raster. This is because similar values form bigger polygons and then I have problems to select by location because the polygon is more big than a pixel Commented Aug 3, 2018 at 19:34

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.