I have this raster wich represent some areas of observation from 3 given points following a series of rules considering elevation and direction of the slope. Basically, the white-ish color represent no point can see this area (0); the orange area is seen from 1 point (1); and the brown area is seen by 2 points (2). Now, I have to calculate the area of each color, specialy the orange and brown ones, but I don't have a clue on how to do it. I tried to convert this raster to vector to calculate te area of the polygon; but when I do it there're lots of polygons and none of them seem to conservate the value of the pixel.

The raster I'm interested in was obtained by the cumulative viewshed tool.

Any idea on how to do it? areas

  • 2
    Could you specify the tools you are using? Also, it looks like (correct my if I am wrong), a raster hillshade with polygons drawn on top? Or is that a raster drawn on top? Or is the entire thing just a png? In any case, what I usually do is clip what you don't want/set everything else to noData, vectorize the area, and calculate it from there. Commented Oct 23, 2017 at 0:42
  • I'm using QGIS, I don't know if that's what you want to know. And about the raster, it's just a screenshot, but there're two different rasters; the one of the elevation and the other one which is the one I want to calculate the area.
    – Bernardo
    Commented Oct 23, 2017 at 0:44
  • 1
    Please use the edit button beneath your question to revise it with any requested clarifications.
    – PolyGeo
    Commented Oct 23, 2017 at 1:02
  • @LennertDeFeyter is correct, convert your raster to vector docs.qgis.org/2.6/en/docs/training_manual/complete_analysis/… then calculate area gis.stackexchange.com/questions/23355/… and for finesse summarize to a table gis.stackexchange.com/questions/43037/… which will be the area of the polygons. The only other way would be to get a count of all the cells by class then multiply by the area of a single cell, which could be done in python but would be more difficult. Commented Oct 23, 2017 at 1:13
  • It seems that when you did the raster to vector you didn't specify a field to put the orange/brown values into.. Is the orange/brown raster a single raster or do you have an orange raster and a brown raster? I'm assuming that it's a single raster with 3 values: orange, brown and NoData. Commented Oct 23, 2017 at 1:15

2 Answers 2


Converting raster to polygon is the right way to go. Without knowing how you've done it, I would use the Polygonize tool (In the Raster > Conversion menu)and use the field name which stores your values.

enter image description here

Another method would be to calculate the number of pixels you have for each value and multiply by the pixel area (length*width).

  • Done, now the problem is that I end up with 991 polygons, though I already calculated the area of everyone. Is there a formula to add up the areas of the polygons with the same value? Or I just can copy & paste to Excel and do it?
    – Bernardo
    Commented Oct 23, 2017 at 1:38
  • I'm not sure why you have so many polygons. It should have combined them. What field did you specify in the above tool?
    – Fezter
    Commented Oct 23, 2017 at 1:48
  • It shows no field... The window I saw is exactly like the image above.
    – Bernardo
    Commented Oct 23, 2017 at 1:55
  • 1
    Comments are not for extended discussion; this conversation has been moved to chat.
    – Fezter
    Commented Oct 23, 2017 at 1:58

I think you could use the r.report from the GRASS toolbox. I expect your raster data has something like NULL for no observation and an integer for the number of observation points. If not you could achieve it by "adding" your rasters The input of r.report is your raster data and report is areas for each value in the raster. Check the manual page of r.report Here the sceershot of the r.report in QGIS and the output.

enter image description here

enter image description here

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.