Bulk Snapping Points to Line Vertex in QGIS?

Geographic Information Systems Asked on January 5, 2022

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

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 January 5, 2022

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

Answered by Jon on January 5, 2022

Add your own answers!

Related Questions

Adding spreadsheet information to KML

0  Asked on November 18, 2020 by bryan


GDAL: sum of all bands in a raster

0  Asked on November 18, 2020 by qdread


Edit GISJOIN attribute ID from census data

0  Asked on November 16, 2020 by user65127


Creating point precisely on line

2  Asked on November 16, 2020 by sweet-sugar-cola


Load and apply Style from Postgres in QGIS 3

2  Asked on November 13, 2020 by simu


Two PopupTemplates

1  Asked on November 12, 2020 by pfalbaum


GeoPackage Lookup Tables

0  Asked on November 12, 2020 by narmaps


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP