[GRASS-user] Calculating Length Between Points On Stream Network

Wolf Bergenheim wolf+grass at bergenheim.net
Mon Mar 8 17:57:33 EST 2010


On Mon, Mar 8, 2010 at 19:07, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> Wolf,
>
>  What you show above is the same two points on both lines. I changed the
> file 'nodes' to read:
>
> 1|242856.60|431305.07
> 2|242551.88|432149.70

Hi Rich,

Now you are mixing with the format for v.in.ascii. The v.net.path fomat is:
id start_point_x start_point_y end_point_x end_point_y
where id is a number, then comes the x and y coordinate points for the
starting point and then comes the x and y coordinate pair for the end
point. All fields are separated by a single space. Hope this helps!

The id will become the cat of the new shortest path. So if you specify
multiple lines toy will get multiple paths

For a trivial example you might have (the coordinates are going to be
different in your map)
1 11.22 43.22 32.12 45.21

Which will find the shortest path from point (11.22, 43.22) to point
(32.12, 45.21) along your stream network. This single line will be
stored in the output map (stream_length in your case). Now you can use
v.to.db. to query the length of this (or all if you have multiple
paths) like this:

v.to.db -p map=stream_length option=length type=line

Add units=k for length in km.

See the manual pages for more info:
http://grass.osgeo.org/grass65/manuals/html65_user/v.net.path.html
http://grass.osgeo.org/grass65/manuals/html65_user/v.to.db.html

Hope this helps,
Wolf


More information about the grass-user mailing list