5

I want to calculate the overlap area of buffered points in QGIS.

I have tried 'Polygon self-intersection' of the buffered points, but there is only 1 overlap area for each overlap.

For example in the image below, the selected area actually belongs to no 76 & 77, but there is only 1 polygon with ID 76|77. So, my question is how to calculate the overlap area of each point?

For example point 76 have xxx m2 overlap area which is from overlap with points 77, 102, 75, and 51. Since the ID for each overlap area is unique, I find it is difficult to aggregate the overlap area that belongs to each point.

Self-intersection polygon

0

3 Answers 3

4

You can use the following expression on your points layer to create a new attribute with the overlapping area of all overlapping neighbours using field calculator (the function overlay_nearest is available in QGIS 3.16 +):

area (
    intersection( 
        buffer ($geometry, 120), 
        buffer (
            collect_geometries (
                overlay_nearest( 
                    @layer, 
                    buffer ($geometry, 120),
                    limit:=100          )
            )
        ,0)
    )
)

Screenshot: the blue circles are created dynamically with geometry generator from the points using the epxression buffer ($geometry, 120). The yellow polygons (intersections) are created with the geometry generator and the expression highlighted in yellow: the same as above, minus the area() function. The labels show the area of the yellow area, calculated with the expression from above. For comparison: On the bottom left there are two points at the same location, so their buffers overlapt perfectly. On the top right there is a buffer that does not overlap at all. enter image description here

2
  • Hi, after I try the expression that you give minus area() function in geometry generator, it only show the buffer area, not the overlap area. Same with the expression in field calculator, it only calculate the area of the buffer (all calculated area is same). Is there anything I have to adjust or edit on your given expression?
    – Dzidzu
    Commented Mar 25, 2021 at 6:17
  • Which version of QGIS doe you use? The expression works for ver. 3.16 and later. You only have to adjust the value of the buffer distance - 120 in my case. Can you provide a screenshot if the problem persists?
    – Babel
    Commented Mar 25, 2021 at 6:44
3

I think it can be shorter but here a solution :

  1. Create a field to have the area of each buffer, e.g. : buffer_area
  2. Do an Union vector overlay processing (documentation) and we named it lyr_union
  3. Create in lyr_union an id field with unique identifiers (computed with $id for example)
  4. Go to Database > DB Manager > Virtual Layers and execute the following query :
SELECT
  lyr_union.id,
  lyr_union.buffer_area - ST_AREA(lyr_union.geometry) AS overlap_area
FROM lyr_union
WHERE NOT EXISTS (
  SELECT 1
  FROM lyr_union t1, lyr_union t2
  WHERE
    t1.geometry = t2.geometry
    AND t1.id <> t2.id
    AND u2.id = t1.id
)

Explanations

  • Union cuts buffers where the layer overlaps
  • The subquery selects the parts of the union layer that overlap
  • The query selects the parts of the union layer that are not in the subquery, so parts that don't overlap.
  • Finally, we remove the buffer complete area from the area that doesn't overlap = area that overlaps.
1

After several attempts, I finally find out how to do that without using any expressions since I am not good at "coding work".

The steps are:

  1. Give the point layer the id using $id in the field calculator
  2. Buffer the point layer, then calculate the area, say "BUFF_AR"
  3. Union the buffer layer, use buffer layer as input & overlay layer, then calculate the area, say "OVER_AR"
  4. Extract by attribute, Set "OVER_AR" < value of "BUFF_AR". Name the layer as 'overlap area'
  5. Aggregate the 'overlap area', grouped by id_2. Select "SUM" in aggregate function for "BUFF_AR", while others are "First value". Select load template from 'overlap area'
  6. Join attribute by field value between buffer layer (select "id") & aggregated overlap area (select "id_2") and select "OVER_AR" for layer 2 field to copy

My homework then is how to automate the work using Graphical Modeler.

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.