4

I am new to QGIS and have two vector layers (the green one, displayed in graduated symbology, and separately the orange layer - see image pasted below). I want to create a new field in the attribute table of the green layer, to calculate what percentage of each polygon is covered by an orange polygon.

I have got as far as creating a column in the green layer's attribute table, but I can't find a tool which calculates intersections without creating a new layer.

enter image description here

3
  • Why don't you want to create a new layer?
    – Erik
    Commented Oct 27, 2021 at 15:56
  • I may be wrong of course - I thought there would be a way of just creating an attribute of the layer which already exists? Alternatively if there is a way to do this by creating a new layer but whilst retaining information in other attribute table columns from the green layer, I would be open to this! Commented Oct 27, 2021 at 16:00
  • As per the help center please do not include chit chat like statements of appreciation within your posts.
    – PolyGeo
    Commented Oct 28, 2021 at 5:01

1 Answer 1

15

Create a new attribute with Field calculator using this expression (replace orange on line 6 with the name of your "orange" layer):

area(
    intersection(
        $geometry,
        collect_geometries( 
            overlay_intersects(
                'orange', -- name of another layer
                $geometry
                )
            )
        )
    )
/area ($geometry)*100

The expression applied on the green layer (here as dynamic label for demonstration purpose), calculating the area of the overlapping part of the orange layer, divided by the area of the green layer. The overlapping part is highlighted in red:

enter image description here

0

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.