3

Using QGIS, I have a single-band raster with with multiple counties. I have reclassified the pixels into 2 categories, using a singleband pseudocolor, based on their value ( > or < 3800), corresponding to non-forest or forest land.

How do I calculate the proportion of pixels that is in each of the 2 categories, in each county?

I have a lot of images over a lot of years so I would prefer to not take the route the I figured out - converting to shp, exporting as csv, sorting csv and calculating percentages in Excel.

Raster with several counties Table of Contents

  • it's not entirely clear from your question if your "multiple counties" are available as a polygon layer, can you confirm this? – dmci Jan 14 '16 at 12:47
3

Zonal Statistics https://docs.qgis.org/2.2/en/docs/user_manual/plugins/plugins_zonal_statistics.html

Or just extract the rasters by the polygons Clip raster layer with *raster* mask layer in QGIS

It has been while since I used the zonal statistics but I remember it give a count value.

enter image description here

  • Yes. I had discovered the Zonal Statistics plugin and had it working nicely - giving me a summary of each county. The problem is that it doesn't give me values per category, ie forested vs non-forested (the ones shown in my TOC). Any way to get it to show me # of pixels/category? – user65148 Jan 13 '16 at 1:15
  • Thanks makes sense for nominal data, I may be mixing the arc and qgis zonal functions. just make two rasters and give each pixel a value of 1 and then it is the sum in this table or the count. Forested= 1 in one and unforested = 1 in the other. right? – If you do not know- just GIS Jan 13 '16 at 2:04
  • That doesn't quite make sense to me. How do I give each pixel a 1? – user65148 Jan 13 '16 at 2:27
  • Im saying if all pixels are 1 or 0 then the sum of the pixels is the count. So <3800 to 1. – If you do not know- just GIS Jan 13 '16 at 2:33

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.