I have a raster layer of landuse and a vector layer of areas of interest. I would like to calculate for each polygon (areas of interest) the proportion or number of cells of the raster for each category. I would like to get a table of areas in rows, raster categories in column and the number / proportion of cell for each combination.

I'm sure there is an easy way to do that but I couldn't find it. All I got was global statistics through Zonal Stats but I couldn't calculate per category.


I had a very similar situation, and came across this answer

Essentially, you have to create an indicator gird of 0s and 1s, for each of your landuse types. And then use a combination of Count and Sum from the Zonal Statistics plugin. Count will give total number of raster cells in each polygon, and Sum will give number of cells = 1. You can then determine proportion of cover within each polygon. Maybe a bit cumbersome if you have a lot of landuse types, but straightforward.


As of QGIS 3.2 there is a Zonal Histogram tool which should perform this automatically, saving the need to create multiple indicator grids.

  • The Zonal Histogram is a perfect tool in QGIS 3.x for zonal analysis. – nickan Aug 19 '19 at 7:30

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.