I have a raster layer of land use 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 columns 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.

1 Answer 1



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

Original answer:

I had a very similar situation, and came across https://gis.stackexchange.com/a/81047/16141

Essentially, you have to create an indicator grid of 0s and 1s for each of your land use 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 land use types, but straightforward.

  • The Zonal Histogram is a perfect tool in QGIS 3.x for zonal analysis.
    – HMadadi
    Commented Aug 19, 2019 at 7:30

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.