4

Is there an easy way to snap lines to nearest point of either a line or a polygon? I don't see any snapping options for line layers as suggested on How to merge lines with slightly different endpoints in QGIS?

  • 1
    Snap when? When manually editing? – BritishSteel Feb 1 '15 at 13:31
  • When editing or creating the lines – Dani Valverde Feb 1 '15 at 13:39
7

You have to allow snapping and then play around with the options until you configure settings that suit your needs best. You can open the snapping options as shown here:

enter image description here

And then configure your settings, either using map units or pixels as your tolerance unit.

Alternatively you could go to Options (same screenshot), and then navigate to the Digitizing tab.

EDIT:
You have to set the options on the vector that other vectors should be snapping to. In your case you would have to activate snapping on your point dataset. Like this, for example:

enter image description here

Now, if you get within 5 pixels of a point the line would snap to it.

EDIT #2:
I read your question again. The points you are talking about are called vertexes. These are the points that make up lines or polygons. So, set the snapping on the feature that you want other features to snap to, and set the vertex option.

  • That's what I was trying, but there's no snapping option for line layers – Dani Valverde Feb 1 '15 at 14:41
  • Check out my edit. – BritishSteel Feb 1 '15 at 15:46
3

In QGIS 3.0 there is a geoprocessing algorithm called 'Snap Geometries to Layer' which works for lines or points (possibly polygons, haven't tested) and has some options on how the algorithm behaves.

Quick Tip - type CTRL + K to open the 'Locate Window' which allows you to search for QGIS functions, layers etc.

enter image description here

the help file states:

Snap geometries to layer This algorithm snaps the geometries in a layer. Snapping can be done either to the geometries from another layer, or to geometries within the same layer.

A tolerance is specified in layer units to control how close vertices need to be to the reference layer geometries before they are snapped. Snapping occurs to both nodes and edges.

Depending on the snapping behavior, either nodes or edges will be preferred. Vertices will be inserted or removed as required to make the geometries match the reference geometries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.