6

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.

Andre Silva
  • 10,259
  • 12
  • 54
  • 106
Victor Cz
  • 61
  • 1
  • 2

1 Answers1

3

Update:

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.


EcologyTom
  • 551
  • 5
  • 16