In QGIS I wanted to move points to the nearest lines. I checked the solutions here, but there are using tools which I am not familiar to yet (PostGIS or GRASS GIS). I figured out my own way with using QGIS but it is giving me weird results.
My problem is that moved points are not exactly on the lines, there is
0.0000 length line beetwen them.
Working process: I connected the lines with points using v.net.connect, then I extracted only the lines beetween points and orignal lines layer (let's call them join). I created start and ending points on the join layer using small python code:
from qgis.core import * import qgis.utils layers = iface.legendInterface().layers() points =  for i in layers.getFeatures(): geom = i.geometry() a = geom.asPolyline() points.append(a) vl = QgsVectorLayer("Point", "beg_end", "memory") pr = vl.dataProvider() vl.startEditing() for i in range(len(points)-1): fet = QgsFeature() fet2 = QgsFeature() fet.setGeometry(QgsGeometry.fromPoint(QgsPoint(points[i]))) fet2.setGeometry(QgsGeometry.fromPoint(QgsPoint(points[i][len(points[i])-1]))) pr.addFeatures([fet]) pr.addFeatures([fet2]) vl.commitChanges() vl.updateExtents() QgsMapLayerRegistry.instance().addMapLayer(vl)
In the end I saved the end points of the join which are supposed to lie on my line layer (and they look like they are there). But if I use connect tool from networks plugin it turns out that it is creating 0.0000 length line between moved points and original lines to join them.
Why the points are not on the lines and what is the reason of this small differences? Is it possible to snap them to the lines and how?