[GRASS-user] snapping points to lines issue

Has anyone had issues using the v.clean, v.distance, v.patch, v.clean trick to snap points to a nearby set of lines?
I am running GRASS version 6.4.4 on a Windows 7 PC.
I have USGS stream gauge locations I am trying to snap to a stream and then create a network ...
there are 15 gauges located from 1.9 to 260 meters from my stream vector and using the above process only 11 of the 15 "snap" to the stream...
I have attached the mapset containing all of the data and maps, a text copy of the commands I use in my shell script, and a readme with set-up instructions if you want to use my mapset...
I also included a few images of what is happening for a quick visual.
The grey circles are the gauge locations and the red triangles are the "snapped" points on the stream vector.
The problem does not seem to be related to distance (failed points are from 2 to 260m away, successful ones are in a similar range)
Any help would be greatly appreciated!
Thank you
:slight_smile:
Chris

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.

bartolomei.chris@ensco.com

The information contained in this email message is intended only for the use of the individual(s) to whom it is addressed and may contain information that is privileged and sensitive. If you are not the intended recipient, or otherwise have received this communication in error, please notify the sender immediately by email at the above referenced address and note that any further dissemination, distribution or copying of this communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of technology originating in the United States. This includes the electronic transmission of information and software to foreign countries and to certain foreign nationals. Recipient agrees to abide by these laws and their regulations -- including the U.S. Department of Commerce Export Administration Regulations and the U.S. Department of State International Traffic in Arms Regulations -- and not to transfer, by electronic transmission or otherwise, any content derived from this email to either a foreign national or a foreign destination in violation of such laws.

(attachments)

Snap_point_error_images.zip (294 KB)
readme.txt (1.05 KB)
GRASSscript_LRS.txt (3.37 KB)

I have come across similar problems to what you describe below. Now I switched strategy, and this workflow seems to work perfectly: I use the “to_x , to_y” upload options of v.distance to save to the original station points file the X and Y coordinates of the snapped location. Then I extract those coords and pipe them straight into v.in.ascii, thus creating the new snapped locations point vector.

# Add columns to the stations vector for snapped_x and snapped_y and get coordinates
v.db.addcolumn --q map=$POINTS columns="snap_x double, snap_y double"
v.distance --q --o from=stations to=streams output=connectors upload=to_x,to_y column=snap_x,snap_y

# Create a new stations vector with the snap_x and snap_y columns
g.remove -f vect name=frxst_pts
v.out.ascii --q -c stations columns="id,station_name,station_num,longitude,latitude,snap_x,snap_y" separator=comma | v.in.ascii --o input=- output=frxst_pts x=8 y=9 cat=3 columns="east double,north double,id integer,station_name text,station_num integer,longitude double,latitude double,snap_x double,snap_y double" separator=comma skip=1

Hope that helps

···

On 03/14/2016 08:13 PM, Bartolomei.Chris wrote:

Has anyone had issues using the v.clean, v.distance, v.patch, v.clean trick to snap points to a nearby set of lines?
I am running GRASS version 6.4.4 on a Windows 7 PC.
I have USGS stream gauge locations I am trying to snap to a stream and then create a network ...
there are 15 gauges located from 1.9 to 260 meters from my stream vector and using the above process only 11 of the 15 "snap" to the stream...
I have attached the mapset containing all of the data and maps, a text copy of the commands I use in my shell script, and a readme with set-up instructions if you want to use my mapset...
I also included a few images of what is happening for a quick visual.
The grey circles are the gauge locations and the red triangles are the "snapped" points on the stream vector.
The problem does not seem to be related to distance (failed points are from 2 to 260m away, successful ones are in a similar range)
Any help would be greatly appreciated!
Thank you
:)
Chris

Chris Bartolomei P.E.
Engineer/Scientist
ENSCO, Inc.

[bartolomei.chris@ensco.com](mailto:bartolomei.chris@ensco.com)

The information contained in this email message is intended only for the use of the individual(s) to whom it is addressed and may contain information that is privileged and sensitive. If you are not the intended recipient, or otherwise have received this communication in error, please notify the sender immediately by email at the above referenced address and note that any further dissemination, distribution or copying of this communication is strictly prohibited.

The U.S. Export Control Laws regulate the export and re-export of technology originating in the United States. This includes the electronic transmission of information and software to foreign countries and to certain foreign nationals. Recipient agrees to abide by these laws and their regulations -- including the U.S. Department of Commerce Export Administration Regulations and the U.S. Department of State International Traffic in Arms Regulations -- and not to transfer, by electronic transmission or otherwise, any content derived from this email to either a foreign national or a foreign destination in violation of such laws.

This mail was received via Mail-SeCure System.

_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[http://lists.osgeo.org/mailman/listinfo/grass-user](http://lists.osgeo.org/mailman/listinfo/grass-user)
This mail was received via Mail-SeCure System.

Micha Silver
Arava Drainage Authority
+972-523-665918

On 14/03/16 19:13, Bartolomei.Chris wrote:

Has anyone had issues using the v.clean, v.distance, v.patch, v.clean trick to snap points to a nearby set of lines?
I am running GRASS version 6.4.4 on a Windows 7 PC.
I have USGS stream gauge locations I am trying to snap to a stream and then create a network ...
there are 15 gauges located from 1.9 to 260 meters from my stream vector and using the above process only 11 of the 15 "snap" to the stream...
I have attached the mapset containing all of the data and maps, a text copy of the commands I use in my shell script, and a readme with set-up instructions if you want to use my mapset...
I also included a few images of what is happening for a quick visual.
The grey circles are the gauge locations and the red triangles are the "snapped" points on the stream vector.
The problem does not seem to be related to distance (failed points are from 2 to 260m away, successful ones are in a similar range)
Any help would be greatly appreciated!

Try v.net option=connect. Use the '-s' flag if you want to snap the points to the network.

Moritz

[Please keep conversations on the list]

On 15/03/16 18:42, Bartolomei.Chris wrote:

Hi Moritz, Thanks for the suggestion, I had been using that and the
problem is that the snapping function in v.net actually just creates
small vectors to attach the points without actually moving them.

I just reread your previous mail and saw that you are working with GRASS 6.4. The '-s' flag is only available in GRASS 7. As vector modules have been significantly improved in GRASS 7, I would suggest to use that.

Moritz