10

I have two polygon layers, 'model' and 'ntem', whose features overlap and intersect one another.

I would like to calculate the proportion of the area of the 'model' polygons which fit within each 'ntem' polygon. Some 'model' features fully fit within 'ntem' features, others overlap multiple 'ntem' features. Both layers are in CRS OSGB:1936.

model layer

ntem layer

both layers

For example, 'model' feature 50209 falls partly in each of the three 'ntem' features 2202, 2205, 2206 and I'd eventually like to know the proportion of 50209's area in each 'ntem' area.

From initial research, I understand that the Vector > Geoprocessing Tools > Intersect function should do what I want, however I get a completely blank layer of results when I attempt this. (shapefile is created, empty attribute table, no features!)

Can anyone either point out if I am doing something wrong and suggest an alternative method of achieving the area proportion calculation?

Taras
  • 32,823
  • 4
  • 66
  • 137
Gonja
  • 497
  • 4
  • 12

2 Answers2

11

Take your model layer and in the attribute table, add a new field called area_mod for example.

Note that there are two ways to generate area:

  • $area is an ellipsoid based calculation using not just the area units but also factors in the projects spatial reference system (SRS) ellipsoid
  • area($geometry) is planimetric where is uses only the area units of the projects SRS

Next run the union tool found in the top menu by going to Vector > Geoprocessing Tools > Union...

Where your Input Layer could be set to ntem and the Overlay layer set to model.

  • Note that the order of the inputs in the union model don't change the result, but only the order of the fields in the attribute table for the resulting union'd layer

Consider saving to a file or other format, instead of [Create temporary layer].


Now you have a new layer in your layer list where you can open the attribute table, enter edit mode and calculate the percentage of overlap compared to the entire area of the model layer.

For example, create a new field in this new union'd layer called area_pct. Then use something like:

($area/"area_mod") * 100

Note that in this case, I used $area to derive area, but in your case be sure to remain consistent and use the same method you used to generate the area in the first step.


You'll have attributes from both inputs used for the union. You'll want to look for the field in the new union'd layer that has a value for your ntem layer - a unique identifier of some sort. Where this value is blank, those are areas from the model layer that fall outside the ntem layer.

SaultDon
  • 10,389
  • 1
  • 43
  • 78
  • Nice answer. I was actually wondering, how would you describe the delta between area($geometry) and $area? Is it about technology or methodology? – Taras May 07 '19 at 05:55
  • 2
    $area returns the area of the polygon considering the ellipsoid, while area($geometry) generates the planimetric area, that is, only considering the coordinates. For small surfaces you could use area($geometry) but for large areas (in your case) it is recommended to use $area. – Luis Perez Oct 26 '21 at 12:17
  • What is the difference between a small area and a large area? In other words, at what map scale should a person use switch over from area($geometry) to $area? – Stu Smith Oct 26 '21 at 14:08
8

The tool you are looking for is Vector > Geoprocessing Tools > Union. This cuts the input polygon into pieces. Then you can calculate the percentage of individual pieces as area of given piece divided by area of original unit (best to add as attribute beforehand, it will be preserved during Union).

o_7O
  • 426
  • 3
  • 2