3

I have a land use classification raster file and a grided (5 km² grids) shapefile of my study region. I want to compute a landscape complexity index (LC) which can be computed by: LC = number of classes / number of pixels of dominant class.

I could compute the number of classes per grid with zonal statistics, but I am struggling with the calculation of the number of pixels of the dominant class per grid. How can that be accomplished?

Taras
  • 32,823
  • 4
  • 66
  • 137
FreddySorbe
  • 355
  • 2
  • 9

1 Answers1

4

Use Zonal histogram tool:

Appends fields representing counts of each unique value from a raster layer contained within polygon features.

enter image description here

BERA
  • 72,339
  • 13
  • 72
  • 161
  • 1
    Thanks, that is a good idea. However, I have 50000 grids in my vector layer. How can I now extract the highest histogram value for each row? – FreddySorbe Nov 12 '21 at 12:17
  • 2
    Field calculator. https://gis.stackexchange.com/questions/323419/finding-minimum-value-of-different-columns-using-qgis – BERA Nov 12 '21 at 12:18