0

I am trying to create a buffer of 5km radius around my points. I am able to build those. Now I want that the two overlapping buffers to dissolve if the intersection/overlap of those shapes is greater than 50%.

The Dissolve function in the buffer window dissolves all overlapping shapes without the required condition.

How can I achieve that?

9
  • 1
    Well, what have you tried? Have you e.g. calculated the area of the overlap and compared it to the total area of the buffers?
    – Erik
    May 25 at 7:22
  • Or you could calculate, how close points need to be to each other in order to meet the 50% overlap criteria, and then add a corresponding attribute to those points close enough to each other for their buffers to be dissolved.
    – Erik
    May 25 at 7:37
  • @Erik. I opened the buffer window using Vector > Geoprocessing Tool > Buffer. And there I checked the option 'Disslove Result' under 'Meter Limit' to dissolve all overlapping buffers.
    – unaeem
    May 25 at 7:39
  • 1
    What happens when say 3 buffers overlap? Does each pair need to be considered separately, or if the total overlap is 50%, do you dissolve? May 25 at 8:54
  • 1
    Does that mean A, B and C should dissolve into one shape if A/B overlap is > 50% and B/C overlap is >50%, but A/C overlap is <50%? May 25 at 10:29

4 Answers 4

3

If I understand your question correctly, the main challenge is where more than two circles are overlapping at the same time.

Based on the closeness of points logic (https://math.stackexchange.com/questions/791975/distance-between-2-circles-with-same-radius-to-overlap-a-desired-percentage), the original points need to be within 0.8079455 x the radius (5km in your case) to have a greater than 50% overlap.

Here's an option you can try. Before you create your buffers, run DBSCAN clustering on the points, with a Minimum cluster size of 1, and Maximum distance of 0.8079455 x radius.

This will give you a CLUSTER_ID field which will persist when you create Buffers. The CLUSTER_ID field can then be used as the Dissolve field in the final step.

enter image description here

enter image description here

2

This expression works with Geometry Generator (for visualization only). Unfortunately, you can't create actual geometries with this as aggregate functions do not work with Geometry by expression.

However, this solution has the advantage that you can teak the values and see the effect changing in realtime. So you can manually change the buffer distance in line 3 and the percentage of the minimum overlap (line 6) to create dissolved buffers. On line 12 you can change the no. of matching features if you want (how many neighbouring points are taken into consideration):

with_variable(
    'dist',
    5000,  -- define buffer distance here
with_variable(
    'overlap',
    50,  -- define the min. overlap in percent
    buffer (
        collect(
            collect_geometries(
                array_filter (
                    array_foreach(
                        overlay_nearest (
                            @layer, 
                            $geometry,
                            limit:=10  -- define how many points should be considered; -1 for all points
                        ),
                        case 
                        when area (
                            intersection (buffer(@element,@dist), buffer ($geometry,@dist))) >= 
                            area (buffer ($geometry,@dist)) * @overlap / 100
                        then buffer ($geometry,@dist)
                        else buffer ($geometry, 0)
                        end
                    ),
                    @element is not NULL
                )
            )
        ),0
    )
))

Black dotted line: all buffers with the defined distance; red polygons: dissolved buffers with overlap >= 50%:

enter image description here

0

To create dissolved buffers as actual geometries, first make a selection with select by expression to select only those points with a buffer that overlaps at least 50%. Then run the buffer tool for the selected features.

  1. Use this expression with select by expression (you can define the buffer distance and percentage of overlap in lines 3 and 6):

     with_variable(
         'dist',
         5000,  -- define buffer distance here
     with_variable(
         'overlap',
         50,  -- define the min. overlap in percent
     array_sum(
         array_foreach(
             overlay_nearest (
                 @layer, 
                 $geometry,
                 max_distance:=@dist*2
             ),
             area (intersection (buffer(@element,@dist), buffer ($geometry,@dist))) >= 
             area (buffer ($geometry,@dist)) * @overlap / 100)
     )))
    
  2. Run the Buffer tool and check the box Selected features only (and Dissolve result as well).

2
  • Will this work when A/B overlap >50%, C/D overlap >50%, B/C overlap < 50% and no other pairs overlap? May 26 at 12:32
  • 1
    I added a new solution to work with that scenario.
    – Babel
    May 26 at 14:56
0

Solution: general idea

This is a more sophisticated solution that creates different buffers when A/B overlap >50%, C/D overlap >50%, B/C overlap < 50% (as asked in the comments).

The basic idea is to create lines between those neighboring points that have buffers overlapping > 50%. Buffers intersecting with this line should be dissolved.

Buffer/dissolve the lines and convert them to single part geometries. Create a new attribute field on the points layer with the id of the buffered line it intersects. Now dissolve the buffers around your points using aggregate tool: like this, you can merge together those buffers with the same id value in the attribute created before.

Red: lines connecting points with buffers that intersect > 50% (step 1); black dotted: individual buffers per point (step 5), orange polygons with red outline: resulting dissolved buffers (step 6): you get two merged buffers that slightly overlap: enter image description here

Step by step how to do it

  1. Run Geometry by Expression to create line connecting those points that have buffer that overlap > 50% with this expression:

     with_variable(
         'dist',
         5000,  -- define buffer distance here
     with_variable(
         'overlap',
         50,  -- define the min. overlap in percent
     array_filter (
         array_foreach(
             overlay_nearest (
                 'points', 
                 $geometry,
                 limit:=10  -- define how many points should be considered; -1 for all points
             ),
             case 
             when area (
                 intersection (buffer(@element,@dist), buffer ($geometry,@dist))) >= 
                 area (buffer ($geometry,@dist)) * @overlap / 100
             then make_line($geometry,@element)
             end
         ),
         @element is not NULL
     )))[1]
    
  2. Buffer the resulting lines with a small distance (like 0.1) and be sure to dissolve the result.

  3. Run Multipart to single parts.

  4. Go back to the initial point layer and use field calculator to creata a new attribute line_id with this expression, where Single parts is the name of the output layer from step 3: overlay_intersects ('Single parts',$id)[0]

  5. Buffer you points without dissolving.

  6. Run Menu Processing > Toolbox > Aggregate and set the field line_id from step 4 as Group by expression. Run the tool and you're done!

Bonus: you might want to delete the dissolved buffer with line_id = 0 - these are single buffers created for those points with buffers that overlap less then 50%.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.