.TH v.net.distance 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBv.net.distance\fR\fR - Computes shortest distance via the network between the given sets of features. .br Finds the shortest paths from a feature 'to' to every feature 'from' and various information about this realtion are uploaded to the attribute table. .SH KEYWORDS vector, network, shortest path .SH SYNOPSIS \fBv.net.distance\fR .br \fBv.net.distance help\fR .br \fBv.net.distance\fR [\-\fBg\fR] \fBinput\fR=\fIname\fR \fBoutput\fR=\fIname\fR [\fBfrom_layer\fR=\fIinteger\fR] [\fBfrom_cats\fR=\fIrange\fR] [\fBfrom_where\fR=\fIsql_query\fR] [\fBto_layer\fR=\fIinteger\fR] [\fBto_cats\fR=\fIrange\fR] [\fBto_where\fR=\fIsql_query\fR] [\fBto_type\fR=\fIstring\fR[,\fIstring\fR,...]] \fBafcolumn\fR=\fIname\fR [\fBabcolumn\fR=\fIname\fR] [\-\-\fBoverwrite\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-g\fR" 4m .br Use geodesic calculation for longitude-latitude locations .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBinput\fR=\fIname\fR" 4m .br Name of input vector map .IP "\fBoutput\fR=\fIname\fR" 4m .br Name for output vector map .IP "\fBfrom_layer\fR=\fIinteger\fR" 4m .br From layer number or name .br A single vector map can be connected to multiple database tables. This number determines which table to use. .br Default: \fI1\fR .IP "\fBfrom_cats\fR=\fIrange\fR" 4m .br From category values .br Example: 1,3,7-9,13 .IP "\fBfrom_where\fR=\fIsql_query\fR" 4m .br From WHERE conditions of SQL statement without 'where' keyword .br Example: income = 10000 .IP "\fBto_layer\fR=\fIinteger\fR" 4m .br Layer number .br To layer number or name .br Default: \fI1\fR .IP "\fBto_cats\fR=\fIrange\fR" 4m .br To category values .br Example: 1,3,7-9,13 .IP "\fBto_where\fR=\fIsql_query\fR" 4m .br To WHERE conditions of SQL statement without 'where' keyword .br Example: income = 10000 .IP "\fBto_type\fR=\fIstring[,\fIstring\fR,...]\fR" 4m .br To feature type .br Options: \fIpoint,line,boundary\fR .br Default: \fIpoint\fR .IP "\fBafcolumn\fR=\fIname\fR" 4m .br Arc forward/both direction(s) cost column .IP "\fBabcolumn\fR=\fIname\fR" 4m .br Arc backward direction cost column .PP .SH DESCRIPTION \fIv.net.distance\fR finds the nearest element in set \fIto\fR for every point in set \fIfrom\fR. .SH NOTES These two sets are given by the respective \fBlayer\fR, \fBwhere\fR and \fBcats\fR parameters. The type of \fIto\fR features is specified by \fBto_type\fR parameter. All \fIfrom\fR features are \fIpoints\fR. A table is linked to \fBoutput\fR map containing various information about the relation. More specifically, the table has three columns: \fIcat\fR, \fItcat\fR and \fIdist\fR storing category of each \fIfrom\fR feature, category of the nearest \fIto\fR feature and the distance between them respectively. Furthemore, \fBoutput\fR map contains the shorest path between each \fIcat\fR, \fItcat\fR 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 \fIfrom\fR feature. And so the shortest paths can be easily obtained by querying lines with corresponding category number. .br The costs of arcs in forward and backward direction are specified by \fBafcolumn\fR and \fBabcolumn\fR columns respectively. If \fBabcolumn\fR is not given, the same cost is used in both directions. .PP \fIv.net.distance\fR will not work if you are trying to find the nearest neighbors within a group of nodes, i.e. where \fIto\fR and \fIfrom\fR 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 \fIto\fR and all other nodes as \fIfrom\fR or create a complete distance matrix with v.net.allpairs and select the lowest non-zero distance for each node. .SH EXAMPLES Find shortest path and distance from every school to the nearest hospital and show path from school number one. \fC .DS .br v.net.distance input=city output=nearest from_where="type=school" \(rs .br to_where="type=hospital" afcolumn=SHAPE_LEN .br d.vect nearest cats=1 .br .DE \fR .SH SEE ALSO \fI v.net.path, v.net.allpairs, v.net.distance, v.net.alloc \fR .SH AUTHORS Daniel Bundala, Google Summer of Code 2009, Student .br Wolf Bergenheim, Mentor .PP \fILast changed: $Date: 2013-05-23 22:01:55 +0200 (Thu, 23 May 2013) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team