4

How to extend lines to Bounding Box in QGIS as in the following image:

enter image description here
Figure 1: Lines

enter image description here
Figure 2: Lines extended to Bounding Box

Link to Shapefile of Bounding Box: https://drive.google.com/drive/folders/1jsJ8m2dG0DNwF1jepxpWzwfUVI5sVJJe?usp=sharing

Link to shapefile of lines: https://drive.google.com/drive/folders/1BQvrMiPillL5ubYsDHfEyoV9st12z0E9?usp=sharing

1

2 Answers 2

5

It may not be the most elegant way. However, you use "Extend line" to extend lines by the distance of the longest edge of the polygon.

enter image description here

The output looks like this and you can clip by Polygon with the "Intersection" tool.

enter image description here

And the output looks like this enter image description here

1
5

Use this expression with Geometry generator or Geometry by expression (see here for details and differences between these two options) - the expression is adapted to the data you provided (layer name: 'Bounding Box', distance to extend the line: 65):

intersection (
    extend (
        $geometry,65,65
    ),
    geometry (
        get_feature_by_id(
            'Bounding Box',0
        )
    )
)

enter image description here

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.