I have a polygon and values of polygon is divided into four categories (showed in four colors in picture). Is it possible to calculate the area covered by each category. Like my values range from 0-5, 5-10, 10-15, 15-20. How much total area is covered by 1st category and how much area covered by second category and so on.

I am doing my analysis on QGIS.

enter image description here

1 Answer 1


You can use an expression such as this one to get the percent of total area for a category:

sum(area($geometry),"your category field") / aggregate(@layer,'sum',area($geometry)) * 100

aggregate() sums up the area of the entire layer and sum(*area*,*group_by*) gets the area for the current features category.

Or to get the total area of a specific category:

sum(area($geometry),filter:="your category field" = 'my category')

I guess from these two you can stitch the one together you prefer if its not already the one. At last note the difference between $area and area($geometry).

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.