0

Using QGIS, is it possible to split all the linestrings in a file only if another linestring's endpoint intersected the linestring but not if they completely cross each other?

For example, the image below shows when the line segments would be split.

enter image description here

While this image shows when they would not be split.

enter image description here

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
  • A combination of https://gis.stackexchange.com/questions/306190/generating-start-and-end-points-for-linestrings and https://gis.stackexchange.com/questions/30447/splitting-line-at-point-positions-using-qgis ? – Michael Stimson May 31 '21 at 02:10
  • 2
    Dear @user8675309, be aware that if you use python-tag, means at one moment you have to provide a snippet of your code that you currently possess, otherwise your question may be closed as not explicit enough. Maybe try firstly focus on a solution without codding. – Taras May 31 '21 at 07:53
  • @Taras: Great that for expression-questions you don't have to provide code-snippets... ;-) – Babel May 31 '21 at 08:34

1 Answers1

1
  1. Create the end-points and the lines and create a small line that passed through this point - the small red lines in the screenshot below. Use this expression with Geomtry by expression (you might change the length of the line - 10000 in my case):

    extend (
        make_line (
            end_point ($geometry), 
            project (
                end_point ($geometry),
                10000,
                radians (
                    angle_at_vertex( 
                        $geometry, -1
        )))),
        10000,
        0
        )
    

  2. Use Split with lines

Screenshot: original lines in black, behind it the blue line is the result with the yellow highlighted part selected. End-points (red) and lines used to split (red) were created with geometry generator for visualization with the expression from above:

enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208