Calculating proportional area of polygon covered by circle
As an alternative answer, this is how you would get QGIS to calculate this live and update automatically when you add or change features:
In the attribute table of the Black Circles layer open the Field Calculator. Tick Create virtual field
and set it to Decimal number.
As the expression use the following:
(area(intersection($geometry, aggregate('Blue Polygon Layer', 'collect', $geometry))) / area($geometry)) * 100
This can be repeated then for other layers using another virtual field.
The breakdown of the above is as follows:
aggregate('Blue Polygon Layer', 'collect', $geometry)
collects the geometries of all the features of Blue Polygon Layer to create one large multipart geometry of the whole layer
intersection($geometry, aggregate('Blue Polygon Layer', 'collect', $geometry))
creates a geometry of the intersecting area of the Black Circle feature and the now aggregated Blue Polygon Layer
(area(intersection($geometry, aggregate('Blue Polygon Layer', 'collect', $geometry))) / area($geometry)) * 100
calculates the area of that intersecting geometry and divides it by the area of the original Black Circle features and multiplies by 100 to get the percent
Some notes on this:
- Both layers will need to be in the same projected coordinate system
- You need to use
area($geometry)
and not$area
(planimetric vs geographic calculation)
Here is a solution based on Virtual Layers in QGIS. It is a mess in SQL to work with a dynamic number of columns, so here the different procentages are show in rows. In a spreadsheet you can pivot the rows to columns if needed.
Test data: Four colored land (myland) and three circles (mycircle):
Run in QGIS Virtual Layers of the Data Source Manager:
with circle_land_intersection as (
select c.name circlename, l.name landname, st_area(l.geometry) total_land_area,
st_intersection(c.geometry,l.geometry) geometry
from mycircle c, myland l
where st_intersects(c.geometry, l.geometry)
),
area_calc as (
select *, st_area(i.geometry) intersect_area
from circle_land_intersection i
)
select *, round(intersect_area/total_land_area*100) pct from area_calc;
You will need to replace mycircle and myland with your own table names in above SQL. Also the column name in both tables should be matching your data. Alternatively you can delete the part:
c.name circlename, l.name landname
Result: