2

I have one vector layer with multiple polygons (purple). I also have a number of other vector layers which are catchment zones (I also have a layer where these catchments are merged).

Is there any way I can sum/calculate the areas of the purple polygons within each of the individual catchment zones?

I need this to work out a percentage of the area taken up by the purple polygons within each catchment.

enter image description here

1
  1. Intersect
  2. Dissolve based on catchment ID
  3. Create new field and calculate area
1

Tested on QGIS 2.18 and QGIS 3.4

I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have ten features in "multiple_polygons" (yellow), and three in "catchment_zones" (grey) accordingly, see image below.

input

With the following Query, it is possible to achieve the result

SELECT c.geometry, c.id, c.Name,
       ROUND(st_area(c.geometry),2) AS "catch_area(m*m)",
       ROUND(SUM(st_area(m.geometry)),2) AS "mult_area(m*m)",
       COUNT(m.geometry) AS "num_mult",
       ROUND(SUM(st_area(m.geometry))/st_area(c.geometry)*100,2) AS "area_%"
FROM "catchment_zones" AS c
JOIN "multiple_polygons" AS m ON st_intersects(c.geometry, m.geometry)
GROUP BY c.id

The output Virtual Layer will maintain the original geometry and some initial attributes including several new, namely 'catch_area(mxm)' (in square meters), 'mult_area(mxm)' (in square meters), 'num_mult' and 'area_%'.

output

P.S. mind the CRS

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.