v.net.path.1grass

Langue: en

Version: 332552 (ubuntu - 24/10/10)

Section: 1 (Commandes utilisateur)

NAME

v.net.path - Finds shortest path on vector network.

KEYWORDS

vector, networking

SYNOPSIS

v.net.path
v.net.path help
v.net.path [-gs] input=name output=name [type=string[,string,...]] [alayer=integer] [nlayer=integer] [file=name] [afcolumn=string] [abcolumn=string] [ncolumn=string] [dmax=float] [--overwrite] [--verbose] [--quiet]

Flags:

-g

Use geodesic calculation for longitude-latitude locations
-s

Write output as original input segments, not each path as one line.
--overwrite

Allow output files to overwrite existing files
--verbose

Verbose module output
--quiet

Quiet module output

Parameters:

input=name

Name of input vector map
output=name

Name for output vector map
type=string[,string,...]

Arc type
Options: line,boundary
Default: line,boundary
alayer=integer

Layer number
Arc layer
Default: 1
nlayer=integer

Layer number
Node layer
Default: 2
file=name

Name of file containing start and end points. If not given, read from stdin
afcolumn=string

Arc forward/both direction(s) cost column
abcolumn=string

Arc backward direction cost column
ncolumn=string

Node cost column
dmax=float

Maximum distance to the network
If start/end are given as coordinates. If start/end point is outside this threshold, the path is not found and error message is printed. To speed up the process, keep this value as low as possible.
Default: 1000

DESCRIPTION

v.net.path can find shortest path(s) on the vector network. Costs may be either line lengths, or attributes saved in a database table. These attributes values are taken as costs of whole segments. If read from the table, arcs' costs may be different in both directions. Shortest paths are written to output vector map and attached attribute table.

Nodes can be piped into the program from file or from stdin. The syntax is as follows:
id start_point_category end_point_category
or
id start_point_x start_point_y end_point_x end_point_y

Points specified by category must be exactly on network nodes, while, when specifying coordinates, the next node to a given coordinate pair is used.

Attribute table will contain following attributes:

cat - path unique category assigned by module
id - path id (read from input)
fcat - from point category
tcat - to point category
sp - result status:

     0 - OK, path found

     1 - node is not reachable

     2 - point of given category does not exist
cost - travelling costs (on the network, not to/from network) fdist - the distance from first point to the network tdist - the distance from the network to second point

NOTE

If the columns 'afcol', 'abcol' and 'ncol' costs are not specified, the length of network segments is measured and zero costs are assumed for nodes.

When using attributes, the length of segments is not used. To get more precise results, length should be taken indirectly into account by attributes. For example, to get the fastest path the columns 'max_speed' and 'length' are required. The correct fastest path can then be found by specifying afcol=length/max_speed (pg driver). If needed, the line length can be calculated and written to the attributes table by v.to.db.

EXAMPLE

Shortest path from two digitized nodes (Spearfish):
g.copy vect=roads,myroads
v.db.addcol myroads col="forward double precision, backward double precision"

# define traveling costs as inverse of speed limit:
v.db.update myroads col=forward val=1/50
v.db.update myroads col=backward val=1/50
v.db.update myroads col=forward val=1/75 where="label='interstate'"
v.db.update myroads col=backward val=1/75 where="label='interstate'"
v.db.update myroads col=forward val=1/5 where="label='unimproved road'"
v.db.update myroads col=backward val=1/5 where="label='unimproved road'"
v.db.update myroads col=forward val=1/25 where="label='light-duty road, improved surface'"
v.db.update myroads col=backward val=1/25 where="label='light-duty road, improved surface'"
v.db.select myroads
echo "1|601653.5|4922869.2|start
2|593330.8|4924096.6|end" | v.in.ascii cat=1 x=2 y=3 out=startend col="cat integer, \

                         east double precision, north double precision, label varchar(43)"

v.db.select startend

#create lines map connecting points to network (on layer 2)
v.net myroads points=startend out=myroads_net op=connect thresh=200
g.region vect=myroads_net
d.mon x0
d.vect myroads_net
d.vect startend col=red

v.db.select myroads_net

d.vect myroads_net icon=basic/triangle fcol=green size=12 layer=2
d.vect myroads_net disp=cat type=point lsize=14 layer=2
# ... the 'start' and 'end' nodes have category number 1 and 2

# ID as first number, then cat1 and cat2
echo "1 1 2" | v.net.path myroads_net afcol=forward abcol=backward out=mypath
d.vect mypath col=red width=2

SEE ALSO

d.path, v.net, v.net.alloc, v.net.iso, v.net.salesman, v.net.steiner, v.to.db

AUTHOR

Radim Blazek, ITC-Irst, Trento, Italy
Documentation: Markus Neteler

Last changed: $Date: 2007-08-03 14:28:13 +0200 (ven, 03 ago 2007) $

Full index

© 2003-2010 GRASS Development Team