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

  • I tried with zonal stats but it takes into account the pixels that are cutted – Fabio Daniel Trinco Jul 27 '18 at 14:32
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.

  • 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 – Fabio Daniel Trinco Aug 3 '18 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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