Hello Grass-Users!
I'am using QGIS in combination with Grass GIS.
I have the following problem: There are two shapes (point and line) and I would like to snap the points to nearest line. Is it possible to do it automatically?
I would be glad if somebody could help me 
Best Regards
Steffen
--
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
On 11/26/2010 06:32 PM, mails-foren@gmx-topmail.de wrote:
Hello Grass-Users!
I'am using QGIS in combination with Grass GIS.
I have the following problem: There are two shapes (point and line) and I would like to snap the points to nearest line. Is it possible to do it automatically?
I would be glad if somebody could help me 
Here's a procedure that will get you a new point vector, with each point located on a line, and at a location on the line vector closest to the original points. You Use v.distance to create a new line vector of "connectors" from the original points to the lines. Then v.clean to find the points where these connectors intersect the original lines.
First make sure your line vector is clean.
v.clean lines opt=break out=lines_clean
You'll have to have at least one column in the points vector for upload of one of the v.distance options, so this will add to the original point vector both the distance and the cat value of the nearest line
v.db.addcol points col="dist double precision, to_cat integer"
v.distance from=points to=lines_clean out=connectors upload=dist,cat column="dist,to_cat"
Now use a feature of v.clean to locate all line intersections in a vector that has not been cleaned. First merge the connectors and the previously cleaned line vector into a new vector:
v.patch in=lines_clean,connectors out=lines_merged
Finally run v.clean on the merged line vector with the error option
v.clean lines_merged tool=break out=snap_points
This new point vector "snap_points" will contain points exactly on the original line, and at the nearest distance to the original points.
--
Micha
Best Regards
Steffen
--
Micha Silver
Arava Development Co. +972-52-3665918
http://surfaces.co.il