2

I have a point layer and a line layer (old). I projected my points to the closest line of the line layer. For it I used geometry expression

shortest_line(
    @geometry, 
        aggregate('old_line', 'collect', @geometry)
)

So I got two line layer. Now I try to split old line layer by lines from the new layer. I used a tool described here Split Lines at Intersection of Other Lines but it didn't help me. I also tried to union both vector layer and then to use Explode lines. But line wasn't splitted. Could anybody help me? I need two lines instead this yellow line: enter image description here

At the same time another line was splitted. I don't understand what the difference because the points were projected to the closest line with the same expression enter image description here

2
  • I assume it is because your lines to not cross the other lines in most cases, they just touch (or eventually not even that). That they sometimes do may be due to coordinate precision. You could extend your lines a little and try if it will work then. Also take a look at gis.stackexchange.com/questions/184191/…
    – MrXsquared
    Commented Feb 2 at 19:10
  • How could I extend a line? I'm new in QGIS and I don't know.
    – redhat
    Commented Feb 2 at 19:18

1 Answer 1

3

I assume it is because your lines to not actually cross the other lines in most cases, they just touch (or eventually not even that). That they sometimes do touch/cross / do not touch/cross may be due to coordinate precision. You could extend your lines a little and try if it will work then.

extend( 
    shortest_line(
        @geometry, 
            aggregate('l', 'collect', @geometry)
    )
,0,1) --extend start: 0 crs units, extend end: 1 crs unit
0

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.