0

So I have a lines layer and not all of the lines are snapped well ( Image below ) and I need to snap all of these lines together using one of the algorithms that are available in QGIS. I tried to use snap to geometries to layer but this algorithm needs two sources ( Input and Reference ) and my lines at one layer. another way that I tested but did not work for me was using difference algorithm for the lines layer and then using the snap to geometries layer algorithm but also did not work. What i can do in this situation? enter image description here

5
  • If you have two lines, one near the other, on the same layer: how do you decide which is the "correct" one to which the other one should "snap"? How to tell QGIS how it should select the "correct" one and the "to be shifted" one? If you have an answer to this question, you can use overlay_nearest() as described here, works also on the same layer: gis.stackexchange.com/questions/471109/…
    – Babel
    Commented Jan 18 at 7:42
  • In my situation, any line that gets snapped will be ok for me. because it's not necessary to select which one is " Correct " Commented Jan 18 at 11:43
  • And a lots says that The overlay_nearest function and others, respond badly if used with the same layer. Here is a bug report: github.com/qgis/QGIS/issues/47201 Commented Jan 18 at 11:55
  • The problem is: you can't say "it does not matter" to which line it snaps: for the software it does, because it must know what to do. You must tell it how and where to snap, otherwise it can't work. Or it works like line A snaps to line B and line B snaps to line A and you are where your started, just with A and B switched. So please refine your question becaus as it is written now, the task can't be completed. Overlay funtions work for me, even with the same layer. Or you could simply duplicate your layer, then you have two different layers, but containing the same data.
    – Babel
    Commented Jan 18 at 13:35
  • 1
    The Snap geometries to layer tool can take the same layer as both inputs. You provide it a tolerance and a preferred snapping mode. It's not clear from the documentation how it decides which geometry should be the reference but it seems that is not your main concern.
    – Matt
    Commented Jan 18 at 18:30

1 Answer 1

0

I have used Snap geometries to layer and made the input and reference as the same layer and worked fine

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.