v.net.distance - Computes shortest distance via the network between
the given sets of features.
Finds the shortest paths from a feature 'to' to every feature 'from'
and various information about this realtion are uploaded to the
vector, network, shortest path
v.net.distance [-g] input=name output=name [from_layer=integer]
[from_cats=range] [from_where=sql_query] [to_layer=integer]
[to_cats=range] [to_where=sql_query] [to_type=string[,string,...]]
afcolumn=name [abcolumn=name] [--overwrite] [--verbose] [--quiet]
Use geodesic calculation for longitude-latitude locations
Allow output files to overwrite existing files
Verbose module output
Quiet module output
Name of input vector map
Name for output vector map
From layer number or name
A single vector map can be connected to multiple database tables.
This number determines which table to use.
From category values
From WHERE conditions of SQL statement without 'where' keyword
Example: income = 10000
To layer number or name
To category values
To WHERE conditions of SQL statement without 'where' keyword
Example: income = 10000
To feature type
Arc forward/both direction(s) cost column
Arc backward direction cost column
v.net.distance finds the nearest element in set to for every point in
These two sets are given by the respective layer, where and cats
parameters. The type of to features is specified by to_type parameter.
All from features are points. A table is linked to output map
containing various information about the relation. More specifically,
the table has three columns: cat, tcat and dist storing category of
each from feature, category of the nearest to feature and the distance
between them respectively. Furthemore, output map contains the shorest
path between each cat, tcat pair. Each path consist of several lines.
If a line is on the shorest path from a point then the category of this
point is assigned to the line. Note that every line may contain more
than one category value since a single line may be on the shortest path
for more than one from feature. And so the shortest paths can be easily
obtained by querying lines with corresponding category number.
The costs of arcs in forward and backward direction are specified by
afcolumn and abcolumn columns respectively. If abcolumn is not given,
the same cost is used in both directions.
v.net.distance will not work if you are trying to find the nearest
neighbors within a group of nodes, i.e. where to and from are the same
set of nodes, as the closest node will be the node itself and the
result will be zero-length paths. In order to find nearest neighbors
within a group of nodes, you can either loop through each node as to
and all other nodes as from or create a complete distance matrix with
v.net.allpairs and select the lowest non-zero distance for each node.
Find shortest path and distance from every school to the nearest
hospital and show path from school number one.
v.net.distance input=city output=nearest from_where="type=school" \
d.vect nearest cats=1
v.net.path, v.net.allpairs, v.net.distance, v.net.alloc
Daniel Bundala, Google Summer of Code 2009, Student
Wolf Bergenheim, Mentor
Last changed: $Date: 2013-05-23 13:01:55 -0700 (Thu, 23 May 2013) $
© 2003-2013 GRASS Development Team