TransWikia.com

Bulk Snapping Points to Line Vertex in QGIS?

Geographic Information Systems Asked by NPT_Rich on August 30, 2020

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

2 Answers

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

Answered by Jon on August 30, 2020

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.

Answered by Gauchoguitar10 on August 30, 2020

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