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 GRASSGIS). 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?
I solved my problem, trying different approach suggested in answers (creating new vertex on a line, as it is not possible to create point directly on the line).
I use "connect" tool from Networks plugin. It join the point with closest line, as well as split the line into two parts. Then I create points at the end and beggining of the connection (using the python code above). Finally I save points which lie on original lines layer as a moved ones. Seems to work!