I have an ASCII grid file with different colored pixels (red, green, yellow and two intermediate yellow colors) and want to determine the total area covered by each [species distribution model result] category of colored pixel in QGIS. How should I Proceed?
One easy option is the
r.stats module in GRASS. Assuming the ASCII raster is categorized (5 categories with a different value for each), then the
-a option to
r.stats outputs total area for each category.
Micha details the approach I would take (+1). For 'fun' here are a couple of alternatives:
- Open the raster properties, go to the Histopgram tab and click recompute histogram if necessary. There you will see the frequency of each value. Since this is an ascii raster it will be single band, so simply read the frequency for each value and multiply by the pixel area.
- Convert the raster to polygons (could be slow if your raster is huge). Dissolve by value resulting in a polygon layer with five multipolygons. Area is an attribute of polygons so you could either click on a polygon with the query tool and have it tell you, or use the field calculator to make a column to contain the value.