I have around 8000 point features that require snapping to the nearest line vertex. Please see below image for reference. I would like to do this in one go if possible.

Is there a tool in QGIS 3 that I can use to do this?

All the points are within around 1 meter of where they should be. I have tried using V.edit and V.clean but because I don't know what parameters need filling in/selected/checked boxes/etc. It never seems to work.

enter image description here

  • Did you try the "snap" cleaning tool in v.clean? You can (and should) also set the snap tolerance using one of the options in the dialog box. (For QGIS3, there is an option called "v.in.ogr snap tolerance" for me.) If you search "snap" in QGIS processing toolbox, you'll also find a "Snap geometries to layer" tool, which should also accomplish your goal. – Jon Dec 5 '18 at 14:59
  • Thanks @Jon i found the "Snap geometries to layer" worked perfectly and was easy to use. A quick review of the data and all seems fine. Thank you for your prompt response much appreciated. – NPT_Rich Dec 5 '18 at 15:40

Try the "Snap geometries to layer" tool, found in the QGIS processing toolbox.


Like the Jon said, there is an algorithm named Snap geometries to layer in QGIS 3 processing toolbox.

However, you have to pay attention to the options in the Behavior parameter. There are 8 options for the parameter. I've looked at the script code and the first 7 first parameters are related to the enumeration SnapMode present in the class QgsGeometrySnapper. The last one is related to QgsGeometrySnapperSingleSource, but it applies only when using a single layer, i.e., the input and the reference layer are the same.

Note that many options start with Prefer, e.g., the first option, Prefer aligning nodes, insert extra vertices where required, will prefer to snap to the nodes of the reference layer, but in case there aren't any nodes to snap, it will snap to the segments. The part of inserting vertices is, in case the input layer has a line or polygon type, it will insert vertices in order to make the input geometries match along the reference geometries. This isn't the case here, where you want to snap the input point layer to the reference line layer.

From the picture, I suppose you want to snap the points to line intersections that occur at the end points of the lines. So I think the best option is to choose Snap end points to end points only with a tolerance a little bit higher than 1 meter. With this option, if the point can't be snapped to a line end point, it won't be snapped to another place.

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.