TransWikia.com

Extending lines to their Bounding Box in QGIS

Geographic Information Systems Asked by HansrajR on February 9, 2021

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

2 Answers

Use this expression with geometry generator or the Geometry by expression tool - 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

Answered by Babel on February 9, 2021

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

Answered by Nil on February 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP