2

I generated random points within my map in QGIS. Then I created a buffer zone of 5km around each point because it is necessary for my analysis.

However, now the buffer zone crosses over the layer boundaries which I don't want to happen. Is there any way to avoid this? I want the buffer zones to not intersect with the layer boundaries.

See the problem in the screenshot below.

3
  • clip you buffers with the layer boundaries.
    – Erik
    Commented Jul 30, 2021 at 8:52
  • After creating the buffers, can you cut them using the boundary (Vector > Geoprocessing Tools > Clip)?
    – gvanhavre
    Commented Jul 30, 2021 at 8:52
  • Please, do not forget about "What should I do when someone answers my question?"
    – Taras
    Commented Aug 30, 2021 at 5:49

3 Answers 3

2

This would be a two step process.

Once you have generated the buffers you can clip them to the boundary.

This can be done with:

Vector > Geoprocessing Tools > Clip
2

This is a combination of the "Buffer" and "Intersection" within the "Geometry by expression" from the Processing Toolbox (Ctrl+Alt+T).

Let's assume we have five features in 'poly_test' (purplish) and ten in 'random_points_test' (orange) accordingly, see image below.

input

In the "Geometry by expression" window use this formula in the 'Geometry expression' field:

intersection(geom_from_wkt(
                array_to_string(
                    overlay_intersects(layer:='poly_test', expression:=geom_to_wkt($geometry))
                    )
                ),
             buffer($geometry, 150000, 50)
        )

tool_window

for creating buffers that do not exceed the boundary of polygons .

Press Run and get the output

result

1

There is a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have five features in 'poly_test' (purplish) and ten in 'random_points_test' (orange) accordingly, see image below.

input

With the following query, it is possible to create buffers that do not exceed the boundary of some polygons.

SELECT poi.id,
       st_intersection(st_buffer(poi.geometry, 150000), poly.geometry) AS geom
FROM "random_points_test" AS poi
INNER JOIN "poly_test" AS poly ON st_within(poi.geometry, poly.geometry)

The output polygon layer (orange) with its attribute table will look like

result

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.