3

I have a polygon layer representing coastal cliffs and would like to create a line at a certain distance out to sea from this polygon layer (I drew a blue line on the image below to demonstrate).

In effect, this would mean buffering the polygon but only on one side of the polygon features, and as a line rather than a polygon like in the traditional Buffer tool in QGIS. I would then like to join the attributes from the features in the original polygon layer to the new "buffer line" layer.

Is there a tool in QGIS to achieve this?

enter image description here

2 Answers 2

4

If you have a layer for the water body, you can use QGIS expressions with Geometry by expression to generate the lines by 1) creating the buffer, 2) taking only the boundary of the buffer, 3) retain only that part of the buffer-boundary that intersects with the water.

Use this expression and replace the value in line 2 (here: 3000) by the size of your buffer and water with the name of your waterbody-layer. The resulting layer will have all the attributes from the cliff-layer that you use as input:

intersection(
    boundary (buffer ($geometry, 3000)),
     collect_geometries(aggregate( 'water', 'collect',$geometry)))

Screenshot: cliffs (yellow) and waterbody (light blue) as well as dark blue lines, created with the expression from above (here with Geometry Generator for demonstration purpose, but you should use Geoemtry by expression as explained above. As you can see from the labels, the lines have the same attributes/values as the cliff: enter image description here

Edit

If you have several neighboring cliffs, the buffer and it's boundaries will overlap. To keep only the non-overlapping part and separate line-features, use this expression, based on the one above, but then clips the result: the lines that overlap a buffer around the cliff (slightly smaller than the initial buffer) are deleted. Set the buffer-size in the sencod last line (here: 99.9) to a value slightly smaller then the size in line 4 (here: 100):

difference(
    intersection (
        boundary (
            buffer ($geometry,100)
        ),
        collect_geometries(
            aggregate( 
                'water', 
                'collect',
                $geometry
    ))),
    buffer (
        collect_geometries (
            aggregate (
                'cliffs', 
                'collect',
                buffer ($geometry, 0)
        )),
        99.9
))

enter image description here

5
  • What to do if the water layer was not provided?
    – Taras
    Commented Aug 28, 2021 at 11:35
  • Downliad it - e.g. from OpenStreetMap data, using Overpass Turbo
    – Babel
    Commented Aug 28, 2021 at 11:55
  • Thank you @Babel, this is a great answer. It seems to work for a single cliff feature as in the example you shared. However, because I have adjacent polygon features in the cliff dataset, individual buffers are created around each feature so I have multiple buffer lines overlapping, when I actually just need one line with the values from the cliff features "exploded" out to this buffer line, if that makes sense.
    – Simba06
    Commented Aug 28, 2021 at 13:19
  • Added a variant of the solution that should address your problem - di I understand you right?
    – Babel
    Commented Aug 28, 2021 at 16:26
  • @Babel Fantastic solution, works very well. Thank you very much.
    – Simba06
    Commented Aug 30, 2021 at 6:58
3

Maybe not as smartest as the solution suggested by @Babel.

IMHO there is also a possibility to achieve the desired output with the following workflow:

Step 1. Creating the centerline of coastal cliffs. The solution can be found in Finding centrelines from polygons in QGIS? or Creating centerline of river in QGIS?

Step 2. Proceed with the "One side buffer"


Also, I recommend paying attention to this thread: Buffering only sides of polygons in QGIS?. However, most of the approaches will require using the "Polygons to lines" and the "Explode lines" geoalgorithms.

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.