## NAME

v.net.path - Find shortest path on vector network. Reads start/end pointsfrom standard input in 2 possible formats: id start_point_category end_point_category id start_point_x start_point_y end_point_x end_point_y Points specified by category must be exactly on network nodes.

## SYNOPSIS

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

### Flags:

-g
  Use geodesic calculation for longitude-latitude locations
-s
  Write output as original input segments, not each path as one line.

### Parameters:

input=string
  Name of input vector
output=string
  Name of output vector
type=string[,string,...]
  Arc type
  Options: line,boundary
  Default: line,boundary
alayer=integer
  Arc layer
  Default: 1
nlayer=integer
  Node layer
  Default: 2
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 file 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.

## 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 node 9 to 12 (nlayer=1 if no extra table for nodes):

        echo "1 9 12" | v.net.path network afcol=forward abcol=backward out=mypath nlayer=1
        d.vect mypath col=red

## 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

Last changed: $Date: 2005/01/31 09:19:20 $

Help Index