TransWikia.com

QGIS snapping issue

Geographic Information Systems Asked by Daniel Sobolewski on May 4, 2021

I’m facing the issue when I use the snapping tool at line layer in qgis. I turned on "snapping to segments" and then i’ve drawn that green lines (picture below) which touches other (purple) lines. After this i’ve used Vector->Analysis Tools->Line intersections and some of expected points of intersection wasn’t detected. Dots are the points of intersection. I was drawing from bottom to top and vice versa. Is this a qgis problem or any snapping tool issue? Qgis 3.16.0, win 10

enter image description here

One Answer

I can confirm your finding. It seems that even when activated snapping, points do not always snap. When they do and when not seems unpredictable to me. In the screenshot I draw the pink lines first, than the green ones. For the 6 lines on the left side, I started at the bottom, for the 6 lines on the right, I draw them top-down. So from this sample, one could guess that end-point snapping on the pink line is more problematic than starting point, however, there are exceptions.

So it really seems that the lines do not intersect, even though zooming in as much as possible shows the end-point of the green lines always perfectly on the pink ones.

A workaround: create a new layer for the green lines where their ends are a little bit extended to be sure that they cross the pink line. To do this, use the function extend lines from the processing toolbox and set a small distance. If you now use again Line intersections with the extended layer, all intersections show as expected. So this shows that snapping does not guarantee intersection.

enter image description here

Edit: you can use geometry generator to create the same effect, so you don't have to create a new layer. I added a symbol layer on the green layer and defined it by geometry generator:

intersection( 
   extend(
      $geometry,0.1,0.1),
      geometry(
         (get_feature_by_id(
            'pink_layer'
            ,1
          )
       )
     )
)

Answered by Babel on May 4, 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