[GRASS-SVN] r46795 - in grass/branches/develbranch_6/vector:
v.net.alloc v.net.allpairs v.net.bridge v.net.centrality
v.net.components v.net.connectivity v.net.distance v.net.flow
v.net.iso v.net.path v.net.salesman v.net.spanningtree
v.net.steiner v.net.timetable
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 27 03:50:51 EDT 2011
Author: mmetz
Date: 2011-06-27 00:50:51 -0700 (Mon, 27 Jun 2011)
New Revision: 46795
Added:
grass/branches/develbranch_6/vector/v.net.alloc/v_net_alloc_time.png
grass/branches/develbranch_6/vector/v.net.iso/vnetisotime.png
grass/branches/develbranch_6/vector/v.net.salesman/vnetsalesmantime.png
grass/branches/develbranch_6/vector/v.net.steiner/vnetsteinertime.png
Modified:
grass/branches/develbranch_6/vector/v.net.alloc/description.html
grass/branches/develbranch_6/vector/v.net.allpairs/description.html
grass/branches/develbranch_6/vector/v.net.bridge/description.html
grass/branches/develbranch_6/vector/v.net.centrality/description.html
grass/branches/develbranch_6/vector/v.net.components/description.html
grass/branches/develbranch_6/vector/v.net.connectivity/description.html
grass/branches/develbranch_6/vector/v.net.distance/description.html
grass/branches/develbranch_6/vector/v.net.flow/description.html
grass/branches/develbranch_6/vector/v.net.iso/description.html
grass/branches/develbranch_6/vector/v.net.iso/vnetiso.png
grass/branches/develbranch_6/vector/v.net.path/description.html
grass/branches/develbranch_6/vector/v.net.path/vnetpath.png
grass/branches/develbranch_6/vector/v.net.salesman/description.html
grass/branches/develbranch_6/vector/v.net.salesman/vnetsalesman.png
grass/branches/develbranch_6/vector/v.net.spanningtree/description.html
grass/branches/develbranch_6/vector/v.net.steiner/description.html
grass/branches/develbranch_6/vector/v.net.steiner/vnetsteiner.png
grass/branches/develbranch_6/vector/v.net.timetable/description.html
Log:
update documentation
Modified: grass/branches/develbranch_6/vector/v.net.alloc/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.alloc/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.alloc/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,68 +1,145 @@
<h2>DESCRIPTION</h2>
-<em>v.net.alloc</em> allocates subnets for nearest centres (direction from
-centre). Centre node must be opened (costs >= 0). Costs of centre node are
-used in calculation. Supported are cost assignments for both arcs and nodes,
-and also different in both directions of a vector line. For areas cost will
-be calculated along boundary lines.
+<em>v.net.alloc</em> allocates subnets for nearest centers (direction from
+center). center nodes must be opened (costs >= 0). Costs of center nodes are
+used in the calculation.
+<p>
+Costs may be either line lengths, or attributes saved in a database
+table. These attribute values are taken as costs of whole segments, not
+as costs to traverse a length unit (e.g. meter) of the segment.
+For example, if the speed limit is 100 km / h, the cost to traverse a
+10 km long road segment must be calculated as
+length / speed = 10 km / (100 km/h) = 0.1 h.
+Supported are cost assignments for both arcs and nodes,
+and also different costs for both directions of a vector line.
+For areas, costs will be calculated along boundary lines.
+<p>
+The input vector needs to be prepared with <em>v.net operation=connect</em>
+in order to connect points representing center nodes to the network.
<h2>NOTES</h2>
-Center nodes have to be assigned to vector nodes using <em>v.digit</em>
-or added from other map(s). Nodes and arcs can be closed using cost = -1.
+Nodes and arcs can be closed using cost = -1.
+<p>
+Center nodes can also be assigned to vector nodes using
+<em><a href="wxGUI.Vector_Digitizing_Tool.html">wxGUI vector digitizer</a></em>.
<h2>EXAMPLES</h2>
-Example 1: <em>Calculating subnets for 3 centre nodes using distances</em>
+<p>
+1. Subnetwork allocation using distance:
+<p>
+<img src="v_net_alloc.png" alt="v.net.alloc example using distance" border="1">
+<br>
+<p>
+2. Subnetwork allocation using traveling time:
+<p>
+<img src="v_net_alloc_time.png" alt="v.net.alloc example using time" border="1">
+<br>
+
+<p>
+Example 1: <em>Calculating subnets for 3 center nodes using distances</em>
<div class="code"><pre>
-#Spearfish
+# Spearfish
-# centre nodes:
+# center nodes:
echo "591235.5|4926306.62|1
596591.8|4917042.5|2
-602722.9|4923544.2|3" | v.in.ascii out=centrenodes
+602722.9|4923544.2|3" | v.in.ascii in=- out=centernodes
g.copy vect=roads,myroads
-#connect points to network
-v.net myroads points=centrenodes out=myroads_net op=connect thresh=200
+# connect points to network
+v.net myroads points=centernodes out=myroads_net op=connect thresh=200
-# view map
-g.region vect=myroads_net
-d.mon x0
-d.vect myroads_net
-d.vect myroads_net col=red icon=basic/triangle fcol=green size=12 layer=2
-
# allocate, specifying range of center cats (easier to catch all):
v.net.alloc myroads_net out=myroads_net_alloc ccats=1-100000 nlayer=2
# report categories
v.category myroads_net_alloc option=report
+</pre></div>
+To display the result, run for example:
+
+<div class="code"><pre>
+# show result
+g.region vect=myroads_net
+d.mon x0
+d.vect myroads_net layer=1
+
# the result has to be selected by category number of the relevant node:
-d.vect myroads_net_alloc cat=1 col=red
-d.vect myroads_net_alloc cat=2 col=green
-d.vect myroads_net_alloc cat=3 col=yellow
+d.vect myroads_net_alloc cat=1 col=red layer=1
+d.vect myroads_net_alloc cat=2 col=green layer=1
+d.vect myroads_net_alloc cat=3 col=yellow layer=1
+
+# center nodes
d.vect myroads_net col=red icon=basic/triangle fcol=green size=12 layer=2
</pre></div>
+
<p>
+Example 2: <em>Calculating subnets for 3 center nodes using traveling time</em><br>
-<img src="v_net_alloc.png" alt="v.net.alloc example" border="1">
+<div class="code"><pre>
+# Spearfish
+# center nodes:
+echo "591235.5|4926306.62|1
+596591.8|4917042.5|2
+602722.9|4923544.2|3" | v.in.ascii in=- out=centernodes
-<p>
-Example 2: <em>Calculating subnets for 7 centre nodes using cost assigned to vector length
-</em><br>
-<div class="code"><pre>
-v.net.alloc in=vectmap out=vectmap.alloc ccats=1-7
+g.copy vect=roads,myroads
+
+# create lines map connecting points to network
+v.net myroads points=centernodes out=myroads_net op=connect thresh=500 alayer=1 nlayer=2
+
+# set up costs
+
+# create unique categories for each road in layer 3
+v.category in=myroads_net out=myroads_net_time opt=add cat=1 layer=3 type=line
+
+# add new table for layer 3
+v.db.addtable myroads_net_time layer=3 col="cat integer,label varchar(43),length double precision,speed double precision,cost double precision,bcost double precision"
+
+# copy road type to layer 3
+v.to.db myroads_net_time layer=3 qlayer=1 opt=query qcolumn=label columns=label
+
+# upload road length in miles
+v.to.db myroads_net_time layer=3 type=line option=length col=length unit=miles
+
+# set speed limits in miles / hour
+v.db.update myroads_net_time layer=3 col=speed val="5.0"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='interstate'"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='primary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="50.0" where="label='secondary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="25.0" where="label='light-duty road, improved surface'"
+v.db.update myroads_net_time layer=3 col=speed val="5.0" where="label='unimproved road'"
+
+# define traveling costs as traveling time in minutes:
+
+# set forward costs
+v.db.update myroads_net_time layer=3 col=cost val="length / speed * 60"
+# set backward costs
+v.db.update myroads_net_time layer=3 col=bcost val="length / speed * 60"
+
+# subnetwork allocation with fastest paths
+v.net.alloc in=myroads_net_time alayer=3 nlayer=2 afcol=cost abcol=bcost out=myroads_net_alloc_time ccats=1-3
</pre></div>
-<p>
+To display the result, run for example:
-Example 3: <em>Calculating subnets for 7 centre nodes using cost assignments in both
-directions</em><br>
<div class="code"><pre>
-v.net.alloc in=vectmap afcol=INDEX abcol=INDEXBACK out=vectmap.alloc ccats=1-7
+# show result
+g.region vect=myroads_net
+d.mon x0
+d.vect myroads_net type=line layer=1
+
+# the result has to be selected by category number of the relevant node:
+d.vect myroads_net_alloc_time cat=1 col=red layer=1
+d.vect myroads_net_alloc_time cat=2 col=green layer=1
+d.vect myroads_net_alloc_time cat=3 col=yellow layer=1
+
+# center nodes
+d.vect myroads_net_time col=red icon=basic/triangle fcol=green size=12 type=point layer=2
</pre></div>
<h2>SEE ALSO</h2>
@@ -76,7 +153,8 @@
<h2>AUTHOR</h2>
-Radim Blazek, ITC-Irst, Trento, Italy
+Radim Blazek, ITC-Irst, Trento, Italy<br>
+Documentation: Markus Neteler, Markus Metz
<p><i>Last changed: $Date$</i>
Added: grass/branches/develbranch_6/vector/v.net.alloc/v_net_alloc_time.png
===================================================================
(Binary files differ)
Property changes on: grass/branches/develbranch_6/vector/v.net.alloc/v_net_alloc_time.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: grass/branches/develbranch_6/vector/v.net.allpairs/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.allpairs/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.allpairs/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,16 +1,32 @@
<h2>DESCRIPTION</h2>
-<em>v.net.allpairs</em> computes the shortest path between each select node and all other nodes.
+<em>v.net.allpairs</em> computes the shortest path between each select
+node and all other nodes.
<h2>NOTES</h2>
-An attribute table is created and linked to <b>layer</b>. The table contains three columns: <em>cat</em>, <em>to_cat</em>, <em>cost</em>. Each entry denotes the cost of the shortest path from <em>cat</em> to <em>to_cat</em>. If the cost is negative then no path exists. If points are specified by <b>cats, layer</b> or <b>where</b> parameters then the table is filled only for the selected points. In other words, <em>cat</em> columns contains only selected points but the distances are computed and updated for <em>all</em> other nodes.<br>
-If flag <b>-a</b> is set then new points are added on nodes without nodes. These points have the largest categorie. Precisely, category of each new point is larger than any of the old categories. If the flag is not set then no new points are created and hence the attribute table stores the costs only between the points already present in the input. Output consists of all points mentioned in either of the columns.<br>
-If <b>abcolumn</b> is not given then then the same costs are used for forward and backward arcs.
+An attribute table is created and linked to <b>layer</b>. The table
+contains three columns: <em>cat</em>, <em>to_cat</em>, <em>cost</em>.
+Each entry denotes the cost of the shortest path from <em>cat</em> to
+<em>to_cat</em>. If the cost is negative then no path exists. If points
+are specified by <b>cats, layer</b> or <b>where</b> parameters then the
+table is filled only for the selected points. In other words, <em>cat</em>
+columns contains only selected points but the distances are computed and
+updated for <em>all</em> other nodes.<br>
+If flag <b>-a</b> is set then new points are added on nodes without points.
+These points have the largest category. Precisely, the category of each new
+point is larger than any of the old categories. If the flag is not set
+then no new points are created and hence the attribute table stores the
+costs only between the points already present in the input. Output consists
+of all points mentioned in either of the columns.<br>
+If <b>abcolumn</b> is not given then then the same costs are used for
+forward and backward arcs.
<h2>EXAMPLES</h2>
-Find shortest path from each intersection with pedestrian crossing to every other point using <em>SHAPE_LEN</em> for the cost of traversing the arcs in both directions.
+Find shortest path from each intersection with pedestrian crossing to
+every other point using <em>SHAPE_LEN</em> for the cost of traversing
+the arcs in both directions.
<div class="code"><pre>
v.net.allpairs input=roads output=roads_pairs afcol=SHAPE_LEN where="crossing=1"
</pre></div>
Modified: grass/branches/develbranch_6/vector/v.net.bridge/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.bridge/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.bridge/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -3,11 +3,24 @@
<em>v.net.bridge</em> finds bridges and articulation points in a network.
<h2>NOTES</h2>
-Bridge in a network is an edge/line whose removal would disconnect the (sub-)network. A node is an articulation point if its removal would disconnect the (sub-)network. For more information and formal definitions check the wikipedia entries: <a href="http://en.wikipedia.org/wiki/Bridge_%28graph_theory%29">bridge</a> and <a href="http://en.wikipedia.org/wiki/Cut_vertex">articulation point</a>.<br><br>
-The output of the module contains the selected features. If <b>method=bridge</b> then lines corresponding to bridges are copied from the input map to the output map. On the other hand, if <b>method=articulation</b> then point are created on the positions of articulation points.<br><br>
+Bridge in a network is an edge/line whose removal would disconnect the
+(sub-)network. A node is an articulation point if its removal would
+disconnect the (sub-)network. For more information and formal definitions
+check the wikipedia entries:
+<a href="http://en.wikipedia.org/wiki/Bridge_%28graph_theory%29">bridge</a>
+and <a href="http://en.wikipedia.org/wiki/Cut_vertex">articulation point</a>.<br><br>
+The output of the module contains the selected features. For
+<b>method=bridge</b>, lines corresponding to bridges are copied from
+the input map to the output map. On the other hand, for
+<b>method=articulation</b>, points are created on the positions of
+articulation points.<br><br>
-<br>In GRASS, <em>line</em> is not always a single line segments. It might be, and often is, a sequence of line segments between two intersections. Also, articulation point is a standard graph theoretic terminology which is slightly misleading in GRASS. An articulation point in graph theory is an articulation <em>node</em> in GRASS terminology.
+<br>In GRASS, <em>line</em> is not always a single line segment. It
+might be, and often is, a sequence of line segments between two
+intersections. Also, articulation point is a standard graph theoretic
+terminology which is slightly misleading in GRASS. An articulation point
+in graph theory is an articulation <em>node</em> in GRASS terminology.
<h2>EXAMPLES</h2>
Modified: grass/branches/develbranch_6/vector/v.net.centrality/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.centrality/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.centrality/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,14 +1,31 @@
<h2>DESCRIPTION</h2>
-<em>v.net.centrality</em> computes degree, closeness, betweenness and eigenvector centrality measures.
+<em>v.net.centrality</em> computes degree, closeness, betweenness and
+eigenvector centrality measures.
<h2>NOTES</h2>
-The module computes various centrality measures for each node and stores them in the given columns of an attribute table, which is created and linked to the output map. For the description of these, please check the following <a href="http://en.wikipedia.org/wiki/Centrality">wikipedia article</a>. If the column name is not given for a measure then that measure is not computed. If <b>-a</b> flag is set then points are added on nodes without points. Also, the points for which the output is computed can be specified by <b>cats</b>, <b>layer</b> and <b>where</b> parameters. However, if any of these parameters is present then <b>-a</b> flag is ingored and no new points are added.<br>
-Betwenness measure is not normalised. In order to get the normalised values (between 0 and 1), each number needs to be divided by <em>N choose 2=N*(N-1)/2</em> where N is the number of nodes in the connected component. Computation of eigenvector measure terminates if the given number of iterations is reached or the cummulative <em>squared</em> error between the successive iterations is less than <b>error</b>.
+The module computes various centrality measures for each node and stores
+them in the given columns of an attribute table, which is created and
+linked to the output map. For the description of these, please check the
+following <a href="http://en.wikipedia.org/wiki/Centrality">wikipedia article</a>.
+If the column name is not given for a measure then that measure is not
+computed. If <b>-a</b> flag is set then points are added on nodes without
+points. Also, the points for which the output is computed can be specified
+by <b>cats</b>, <b>layer</b> and <b>where</b> parameters. However, if any
+of these parameters is present then <b>-a</b> flag is ingored and no new
+points are added.<br>
+Betweenness measure is not normalised. In order to get the normalised
+values (between 0 and 1), each number needs to be divided by
+<em>N choose 2=N*(N-1)/2</em> where N is the number of nodes in the
+connected component. Computation of eigenvector measure terminates if
+the given number of iterations is reached or the cummulative <em>squared</em>
+error between the successive iterations is less than <b>error</b>.
<h2>EXAMPLES</h2>
-Compute closeness and betweenness centrality measures for each node and produce a map containing not only points already present in the input map but a map with point on every node.
+Compute closeness and betweenness centrality measures for each node and
+produce a map containing not only points already present in the input map
+but a map with point on every node.
<div class="code"><pre>
v.net.centrality input=roads output=roads_cent closeness=close betweenness=betw -a
</pre></div>
Modified: grass/branches/develbranch_6/vector/v.net.components/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.components/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.components/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,16 +1,28 @@
<h2>DESCRIPTION</h2>
-<em>v.net.components</em> computes the weakly and strongly connected components in a network.
+<em>v.net.components</em> computes the weakly and strongly connected
+components in a network.
<h2>NOTES</h2>
-Two nodes, <em>u</em> and <em>v</em> are in the same strongly connected component if there are directed paths from <em>u</em> to <em>v</em> and from <em>v</em> to <em>u</em>. The nodes are in the same weakly connected component if, ignoring orientation of the edges, there is a path between them.<br>
+Two nodes, <em>u</em> and <em>v</em> are in the same strongly connected
+component if there are directed paths from <em>u</em> to <em>v</em> and
+from <em>v</em> to <em>u</em>. The nodes are in the same weakly connected
+component if, ignoring orientation of the edges, there is a path between
+them.<br>
-The type of components is specified by <b>method</b> parameter. Module creates a table and links it to the given <b>layer</b>. This table contains only two integer columns: <em>cat</em> and <em>comp</em>. If a point or both endpoints of a line belong to the same component then the point/line is written to the output map and appropriate information is stored in the table. If <b>-a</b> flag is set then new points are added on the nodes without points. These points have category numbers larger than any category used in the input map.
+The type of components is specified by <b>method</b> parameter.
+<em>v.net.components</em> creates a table and links it to the given
+<b>layer</b>. This table contains only two integer columns: <em>cat</em>
+and <em>comp</em>. If a point or both endpoints of a line belong to the
+same component then the point/line is written to the output map and
+appropriate information is stored in the table. If <b>-a</b> flag is set
+then new points are added on the nodes without points. These points have
+category numbers larger than any category used in the input map.
<h2>EXAMPLES</h2>
-Any road network should form a single strongly connected components. Otherwise,
-it is impossible to travel between some places.
+Any road network should form a single strongly connected component.
+Otherwise, it is impossible to travel between some places.
<div class="code"><pre>
v.net.components input=roads output=roads_components method=strong
</pre></div>
Modified: grass/branches/develbranch_6/vector/v.net.connectivity/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.connectivity/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.connectivity/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,12 +1,21 @@
<h2>DESCRIPTION</h2>
-<em>v.net.connectivity</em> computes vertex connectivity between two sets. i.e., minimum number of vertices whose removal would separate two given sets.
+<em>v.net.connectivity</em> computes vertex connectivity between two sets,
+ i.e. the minimum number of vertices whose removal would separate two
+ given sets.
<h2>NOTES</h2>
-Two sets (<em>set1</em> and <em>set2</em>) are specified by respective <b>layer</b>, <b>where</b> and <b>cats</b> parameters. Similarly to <a HREF="v.net.flow.html">v.net.flow</a> module, capacities of nodes can be given by <b>ncolumn</b> option. Module finds the set of nodes of minimum total capacitiy separating the two given sets and outputs map containing points on the positions of these nodes. Default capacity, which is used when no column is specified, is one.
+Two sets (<em>set1</em> and <em>set2</em>) are specified by respective
+<b>layer</b>, <b>where</b> and <b>cats</b> parameters. Similarly to
+<a HREF="v.net.flow.html">v.net.flow</a> module, capacities of nodes can
+be given by <b>ncolumn</b> option. <em>v.net.connectivity</em> finds the
+set of nodes of minimum total capacitiy separating the two given sets and
+outputs map containing points on the positions of these nodes. Default
+capacity, which is used when no column is specified, is one.
<h2>EXAMPLES</h2>
-The following command finds the minimum number of intersection separating roads on the left bank from roads on the right bank.
+The following command finds the minimum number of intersections separating
+roads on the left bank from roads on the right bank.
<div class="code"><pre>
v.net.connectivity input=roads output=roads_conn set1_where="bank=left" set2_where="bank=right"
</pre></div>
Modified: grass/branches/develbranch_6/vector/v.net.distance/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.distance/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.distance/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,14 +1,32 @@
<h2>DESCRIPTION</h2>
-<em>v.net.distance</em> finds the nearast element from set <em>to</em> for every element in set <em>from</em>.
+<em>v.net.distance</em> finds the nearast element in set <em>to</em>
+for every element in set <em>from</em>.
<h2>NOTES</h2>
-These two sets are given by the respective <b>layer</b>, <b>where</b> and <b>cats</b> parameters. The type of <em>to</em> features is specified by <b>to_type</b> parameter and all <em>from</em> features are <em>points</em>. A table is linked to <b>output</b> map containing various information about the relation. More specifically, the table has three columns: <em>cat</em>, <em>tcat</em> and <em>dist</em> storing category of each <em>from</em> feature, category of the nearest <em>to</em> feature and the distance between them respectively. Furthemore, <b>output</b> map contains the shorest path between each <em>cat</em>, <em>tcat</em> 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 single line may be on the shortest path for more than one <em>from</em> feature. And so the shortest paths can be easily obtained by qu
erying lines with corresponding category number.<br>
-The costs of arcs in forward and backward direction are specified by <b>afcolumn</b> and <b>abcolumn</b> columns respectively. If <b>abcolumn</b> is not given, the same cost is used in both directions.
+These two sets are given by the respective <b>layer</b>, <b>where</b>
+and <b>cats</b> parameters. The type of <em>to</em> features is specified
+by <b>to_type</b> parameter and all <em>from</em> features are <em>points</em>.
+A table is linked to <b>output</b> map containing various information
+about the relation. More specifically, the table has three columns:
+<em>cat</em>, <em>tcat</em> and <em>dist</em> storing category of each
+<em>from</em> feature, category of the nearest <em>to</em> feature and
+the distance between them respectively. Furthemore, <b>output</b> map
+contains the shorest path between each <em>cat</em>, <em>tcat</em> 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 <em>from</em>
+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
+<b>afcolumn</b> and <b>abcolumn</b> columns respectively. If
+<b>abcolumn</b> is not given, the same cost is used in both directions.
<h2>EXAMPLES</h2>
-Find shortest path and distance from every school to the nearest hospital and show path from school number one.
+Find shortest path and distance from every school to the nearest hospital
+and show path from school number one.
<div class="code"><pre>
v.net.distance input=city output=nearest from_where="type=school" to_where="type=hospital" afcolumn=SHAPE_LEN
d.vect nearest cats=1
Modified: grass/branches/develbranch_6/vector/v.net.flow/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.flow/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.flow/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,10 +1,27 @@
<h2>DESCRIPTION</h2>
-<em>v.net.flow</em> computes the maximum flow and minimum cut between two sets of nodes.
+<em>v.net.flow</em> computes the maximum flow and minimum cut between
+two sets of nodes.
<h2>NOTES</h2>
-The two sets of nodes are called <em>sources</em> and <em>sink</em> and <em>v.net.flow</em> finds the maximimum flow from the former to the latter ones. Edge capacities can be specified by <b>afcolumn</b> for forward direction and <b>abcolumn</b> for backward direction. If the latter parameter is ommited then the same capacity is used in either direction. The sets are given by the respective <b>cats</b>, <b>layer</b> and <b>where</b> parameters. Maximum flow corresponds to the maximum amount of water possibly flowing through the network preserving the capacity constraints and minimum cut to set of edges of minimum total capacity completely separating sources from sinks. The cut produced by this module corresponds to the first fully saturated edges from sources to sinks. An attribute table containing the flow information is linked to the <b>output</b> map. The table consists of two columns: <em>cat</em> and <em>flow</em> and stores the flow along each line. Negative flow mean
s that "water" is flowing in the backward direction. <b>Cut</b> map contains the edges in the minimum cut. <br>
-A famous <a href="http://en.wikipedia.org/wiki/Max-flow_min-cut_theorem">result</a> says that the total amount of water flowing is equal to the minimum cut.
+The two sets of nodes are called <em>sources</em> and <em>sink</em> and
+<em>v.net.flow</em> finds the maximimum flow from the former to the
+latter ones. Edge capacities can be specified by <b>afcolumn</b> for
+forward direction and <b>abcolumn</b> for backward direction. If the
+latter parameter is ommited then the same capacity is used in either
+direction. The sets are given by the respective <b>cats</b>, <b>layer</b>
+and <b>where</b> parameters. Maximum flow corresponds to the maximum
+amount of water possibly flowing through the network preserving the
+capacity constraints and minimum cut to the set of edges of minimum total
+capacity completely separating sources from sinks. The cut produced by
+this module corresponds to the first fully saturated edges from sources
+to sinks. An attribute table containing the flow information is linked
+to the <b>output</b> map. The table consists of two columns: <em>cat</em>
+and <em>flow</em> and stores the flow along each line. Negative flow
+means that "water" is flowing in the backward direction. <b>Cut</b> map
+contains the edges in the minimum cut. <br>
+A famous <a href="http://en.wikipedia.org/wiki/Max-flow_min-cut_theorem">result</a>
+says that the total amount of water flowing is equal to the minimum cut.
<h2>EXAMPLES</h2>
@@ -15,7 +32,8 @@
</pre></div>
<P>
-If all the capacties are one then the minimum cut corresponds to the minimum number of edges separating sources from sinks.
+If all the capacties are one then the minimum cut corresponds to the
+minimum number of edges separating sources from sinks.
<div class="code"><pre>
v.net.flow input=network output=flow cut=cut afcolumn=ones source_cats=1-10 sink_cats=100-100
</pre></div>
Modified: grass/branches/develbranch_6/vector/v.net.iso/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.iso/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.iso/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,64 +1,78 @@
<h2>DESCRIPTION</h2>
-<em>v.net.iso</em> splits net to bands between cost isolines (direction from
-centre). Centre node must be opened (costs >= 0). Costs of centre node are
-used in calculation. Supported are cost assignments for both arcs and nodes,
-and also different in both directions of a vector line. For areas cost will
-be calculated along boundary lines.
+<em>v.net.iso</em> splits a network into bands between cost isolines
+(distance from center). Center nodes must be opened (costs >= 0). The
+costs of center nodes are used in the calculation.
+<p>
+Costs may be either line lengths, or attributes saved in a database
+table. These attribute values are taken as costs of whole segments, not
+as costs to traverse a length unit (e.g. meter) of the segment.
+For example, if the speed limit is 100 km / h, the cost to traverse a
+10 km long road segment must be calculated as
+length / speed = 10 km / (100 km/h) = 0.1 h.
+Supported are cost assignments for both arcs and nodes,
+and also different costs for both directions of a vector line.
+For areas, costs will be calculated along boundary lines.
+<p>
+The input vector needs to be prepared with <em>v.net operation=connect</em>
+in order to connect points representing center nodes to the network.
<h2>NOTES</h2>
-Nodes must be on the isolines.<P>
+Nodes and arcs can be closed using cost = -1.
+<p>
+Nodes must be on the isolines.
-Center nodes have to be assigned to vector nodes. Nodes and arcs can be closed
-using cost = -1.
-<h2>EXAMPLE</h2>
+<h2>EXAMPLES</h2>
-Subdivision of a network into areas:<br>
+The map must contain at least one center (point) on the vector network
+which can be patched into with <a HREF="v.net.html">v.net</a>.
-The map must contain at least one center
-(point) on the vector network which can be patched into with
-<a HREF="v.patch.html">v.patch</a>.
+<p>
+Isonetwork using distance:
+<p>
+<img src="vnetiso.png" alt="v.net.iso example with distance" border="1">
+<p>
+Isonetwork using time:
+<p>
+<img src="vnetisotime.png" alt="v.net.iso example with traveling time" border="1">
+
+<p>
+<h4>Subdivision of a network using distance:</h4>
+
<div class="code"><pre>
# Spearfish
# start node:
-echo "591280.5|4926396.0|1" | v.in.ascii out=startnode
+echo "591280.5|4926396.0|1" | v.in.ascii in=- out=startnode
g.copy vect=roads,myroads
-#connect point to network
+# connect point to network
v.net myroads points=startnode out=myroads_net op=connect thresh=200
-g.region vect=myroads_net
-d.mon x0
-d.vect myroads_net
-d.vect myroads_net col=red icon=basic/triangle fcol=green size=12 layer=2
-v.category myroads_net layer=2 op=print
-
-# specify range of center cats (easier to catch all):
+# define iso networks using distance:
v.net.iso input=myroads_net output=myroads_net_iso ccats=1-100000 costs=1000,2000,5000
-v.category myroads_net_iso option=report
-# ... reports 4 categories:
</pre></div>
-The network is 4 categories:
+The network is divided into 4 categories:
<div class="code"><pre>
-cat | distance from point
-1 0 - 1000
-2 1000 - 2000
-3 2000 - 5000
-4 > 5000
+v.category myroads_net_iso option=report
+# ... reports 4 categories:
+#cat | distance from point in meters
+#1 0 - < 1000
+#2 1000 - < 2000
+#3 2000 - < 5000
+#4 >= 5000
</pre></div>
-To see the result, run for example:
+To display the result, run for example:
<div class="code"><pre>
g.region n=4928200 s=4922300 w=589200 e=596500
-d.erase
-d.vect myroads_net_iso
+d.mon x0
d.vect myroads_net_iso col=blue cats=1
d.vect myroads_net_iso col=green cats=2
d.vect myroads_net_iso col=orange cats=3
@@ -66,8 +80,82 @@
d.vect myroads_net col=red icon=basic/triangle fcol=green size=12 layer=2
</pre></div>
-<img src="vnetiso.png" alt="v.net.iso example" border="1">
+<h4>Subdivision of a network using traveling time:</h4>
+Prepare the network as above:
+<div class="code"><pre>
+# Spearfish
+
+# start node:
+echo "591280.5|4926396.0|1" | v.in.ascii in=- out=startnode
+g.copy vect=roads,myroads
+
+# connect point to network
+v.net myroads points=startnode out=myroads_net op=connect thresh=200
+</pre></div>
+
+Define costs as traveling time dependent on speed limits:
+<div class="code"><pre>
+# set up costs
+
+# create unique categories for each road in layer 3
+v.category in=myroads_net out=myroads_net_time opt=add cat=1 layer=3 type=line
+
+# add new table for layer 3
+v.db.addtable myroads_net_time layer=3 col="cat integer,label varchar(43),length double precision,speed double precision,cost double precision,bcost double precision"
+
+# copy road type to layer 3
+v.to.db myroads_net_time layer=3 qlayer=1 opt=query qcolumn=label columns=label
+
+# upload road length in miles
+v.to.db myroads_net_time layer=3 type=line option=length col=length unit=miles
+
+# set speed limits in miles / hour
+v.db.update myroads_net_time layer=3 col=speed val="5.0"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='interstate'"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='primary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="50.0" where="label='secondary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="25.0" where="label='light-duty road, improved surface'"
+v.db.update myroads_net_time layer=3 col=speed val="5.0" where="label='unimproved road'"
+
+# define traveling costs as traveling time in minutes:
+
+# set forward costs
+v.db.update myroads_net_time layer=3 col=cost val="length / speed * 60"
+# set backward costs
+v.db.update myroads_net_time layer=3 col=bcost val="length / speed * 60"
+
+# define iso networks using traveling time:
+v.net.iso input=myroads_net_time output=myroads_net_iso_time alayer=3 nlayer=2 afcol=cost abcol=bcost ccats=1-100000 costs=1,2,5
+</pre></div>
+
+To display the result, run for example:
+
+<div class="code"><pre>
+# add table with labels and coloring
+v.db.addtable myroads_net_iso_time columns="cat integer,trav_time varchar(20),GRASSRGB varchar(11)"
+# labels
+v.db.update map=myroads_net_iso_time layer=1 column=trav_time value="0 - 1" where="cat = 1"
+v.db.update map=myroads_net_iso_time layer=1 column=trav_time value="1 - 2" where="cat = 2"
+v.db.update map=myroads_net_iso_time layer=1 column=trav_time value="2 - 5" where="cat = 3"
+v.db.update map=myroads_net_iso_time layer=1 column=trav_time value="> 5" where="cat = 4"
+# colors
+# cats=1: blue
+v.db.update map=myroads_net_iso_time layer=1 column=GRASSRGB value="000:000:255" where="cat = 1"
+# cats=2: green
+v.db.update map=myroads_net_iso_time layer=1 column=GRASSRGB value="000:255:000" where="cat = 2"
+# cats=3: orange
+v.db.update map=myroads_net_iso_time layer=1 column=GRASSRGB value="255:128:000" where="cat = 3"
+# cats=4: magenta
+v.db.update map=myroads_net_iso_time layer=1 column=GRASSRGB value="255:000:255" where="cat = 4"
+
+# show results
+g.region n=4928200 s=4922300 w=589200 e=596500
+d.mon x0
+d.vect myroads_net_iso_time layer=1 -a rgb_col=GRASSRGB
+d.vect myroads_net col=red icon=basic/triangle fcol=green size=12 layer=2
+</pre></div>
+
<h2>SEE ALSO</h2>
<em><a HREF="d.path.html">d.path</a></em>,
@@ -81,6 +169,6 @@
<h2>AUTHOR</h2>
Radim Blazek, ITC-Irst, Trento, Italy<br>
-Documentation: Markus Neteler
+Documentation: Markus Neteler, Markus Metz
<p><i>Last changed: $Date$</i>
Modified: grass/branches/develbranch_6/vector/v.net.iso/vnetiso.png
===================================================================
(Binary files differ)
Added: grass/branches/develbranch_6/vector/v.net.iso/vnetisotime.png
===================================================================
(Binary files differ)
Property changes on: grass/branches/develbranch_6/vector/v.net.iso/vnetisotime.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: grass/branches/develbranch_6/vector/v.net.path/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.path/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.path/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,12 +1,28 @@
<h2>DESCRIPTION</h2>
-<em>v.net.path</em> can find shortest path(s) on the vector network.
+<em>v.net.path</em> determines least costly, e.g. shortest or fastest
+path(s) on a vector network.
+
+<p>
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.
+table. These attribute values are taken as costs of whole segments, not
+as costs to traverse a length unit (e.g. meter) of the segment.
+For example, if the speed limit is 100 km / h, the cost to traverse a
+10 km long road segment must be calculated as
+length / speed = 10 km / (100 km/h) = 0.1 h.
+Supported are cost assignments for both arcs and nodes,
+and also different costs for both directions of a vector line.
+For areas, costs will be calculated along boundary lines.
+<p>
+The input vector needs to be prepared with <em>v.net operation=connect</em>
+in order to connect points representing center nodes to the network.
+
+<p>
+Nodes and arcs can be closed using cost = -1.
+<p>
+Least cost paths are written to the output vector map with an
+attached attribute table.
<P>
-
Nodes can be piped into the program from file or from stdin. The
syntax is as follows:
<div class="code"><pre>
@@ -20,12 +36,14 @@
</pre></div>
<p>
-Points specified by category must be exactly on network nodes,
-while, when specifying coordinates, the next node to a given
-coordinate pair is used.
-</p>
+Points specified by category must be exactly on network nodes, and the
+input vector map needs to be prepared with <em>v.net operation=connect</em>.
<p>
-Attribute table will contain following attributes:
+When specifying coordinates, the next network node to a given coordinate
+pair is used.
+
+<p>
+The attribute table will contain the following attributes:
</p>
<ul>
<li>cat - path unique category assigned by module</li>
@@ -43,65 +61,99 @@
<li>tdist - the distance from the network to second point</li>
</ul>
-<h2>NOTE</h2>
-
-If the columns 'afcol', 'abcol' and 'ncol' costs are not
+<h2>NOTES</h2>
+Nodes and arcs can be closed using cost = -1.
+<p>
+If the cost columns 'afcol', 'abcol' and 'ncol' are not
specified, the length of network segments is measured and
zero costs are assumed for nodes.
<P>
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 <b>fastest path</b> the columns
-'max_speed' and 'length' are required. The correct fastest path can then
-be found by specifying <tt>afcol=length/max_speed</tt> (pg driver). If needed,
+accurate results, the line length must be taken into account when
+assigning costs as attributes. For example, to get the <b>fastest path</b>,
+the columns 'max_speed' and 'length' are required. The correct fastest
+path can then be found by specifying <tt>afcol=length/max_speed</tt>. If needed,
the line length can be calculated and written to the attributes table
by <em>v.to.db</em>.
<h2>EXAMPLE</h2>
-Shortest path from two digitized nodes (Spearfish):
+Shortest (red) and fastest (blue) path between two digitized nodes (Spearfish):
+<p>
+<img src="vnetpath.png" alt="v.net.path example" border="1">
+
+<p>
<div class="code"><pre>
-g.copy vect=roads,myroads
-v.db.addcol myroads col="forward double precision, backward double precision"
+# Spearfish
-# 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)"
+echo "1|601955.1|4916944.9|start
+2|594385.6|4921565.2|end" | v.in.ascii in=- cat=1 x=2 y=3 out=startend col="cat integer, \
+ east double precision, north double precision, label varchar(6)"
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.copy vect=roads,myroads
+
+# create lines map connecting points to network
+v.net myroads points=startend out=myroads_net op=connect thresh=500 alayer=1 nlayer=2
+
+# set up costs
+
+# create unique categories for each road in layer 3
+v.category in=myroads_net out=myroads_net_time opt=add cat=1 layer=3 type=line
+
+# add new table for layer 3
+v.db.addtable myroads_net_time layer=3 col="cat integer,label varchar(43),length double precision,speed double precision,cost double precision,bcost double precision"
+
+# copy road type to layer 3
+v.to.db myroads_net_time layer=3 qlayer=1 opt=query qcolumn=label columns=label
+
+# upload road length in miles
+v.to.db myroads_net_time layer=3 type=line option=length col=length unit=miles
+
+# set speed limits in miles / hour
+v.db.update myroads_net_time layer=3 col=speed val="5.0"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='interstate'"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='primary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="50.0" where="label='secondary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="25.0" where="label='light-duty road, improved surface'"
+v.db.update myroads_net_time layer=3 col=speed val="5.0" where="label='unimproved road'"
+
+# define traveling costs as traveling time in minutes:
+
+# set forward costs
+v.db.update myroads_net_time layer=3 col=cost val="length / speed * 60"
+# set backward costs
+v.db.update myroads_net_time layer=3 col=bcost val="length / speed * 60"
+
+# ... the 'start' and 'end' nodes have category number 1 and 2
+
+# Shortest path: ID as first number, then cat1 and cat2
+echo "1 1 2" | v.net.path myroads_net_time alayer=3 nlayer=2 out=mypath
+
+# Fastest path: ID as first number, then cat1 and cat2
+echo "1 1 2" | v.net.path myroads_net_time alayer=3 nlayer=2 afcol=cost abcol=bcost out=mypath_time
+</pre></div>
+
+To display the result, run for example:
+
+<div class="code"><pre>
g.region vect=myroads_net
d.mon x0
d.vect myroads_net
-d.vect startend col=red
+# show shortest path
+d.vect mypath col=red width=2
+# show fastest path
+d.vect mypath_time col=blue width=2
-v.db.select myroads_net
-
+# start and end point
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
+d.font font=Vera
+d.vect startend disp=cat type=point lsize=14 layer=2
</pre></div>
-<img src="vnetpath.png" alt="v.net.path example" border="1">
-
<h2>SEE ALSO</h2>
<em><a HREF="d.path.html">d.path</a></em>,
@@ -115,6 +167,6 @@
<h2>AUTHOR</h2>
Radim Blazek, ITC-Irst, Trento, Italy<br>
-Documentation: Markus Neteler
+Documentation: Markus Neteler, Markus Metz
<p><i>Last changed: $Date$</i>
Modified: grass/branches/develbranch_6/vector/v.net.path/vnetpath.png
===================================================================
(Binary files differ)
Modified: grass/branches/develbranch_6/vector/v.net.salesman/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.salesman/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.salesman/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,35 +1,59 @@
<h2>DESCRIPTION</h2>
<em>v.net.salesman</em> calculates the optimal route to visit nodes on a
-vector network. If no cost column is given, the length of a line (road segment)
-is used to estimate travelling costs. If a cost column is given, the cost
-values must indicate the costs to traverse a given line, e.g. if the speed
-limit is 100 km / h, the cost to traverse a 10 km long road segment is
-calculated as length / speed = 10 km / (100 km/h) = 0.1 h.
+vector network.
+<p>
+Costs may be either line lengths, or attributes saved in a database
+table. These attribute values are taken as costs of whole segments, not
+as costs to traverse a length unit (e.g. meter) of the segment.
+For example, if the speed limit is 100 km / h, the cost to traverse a
+10 km long road segment must be calculated as
+length / speed = 10 km / (100 km/h) = 0.1 h.
+Supported are cost assignments for arcs,
+and also different costs for both directions of a vector line.
+For areas, costs will be calculated along boundary lines.
+<p>
+The input vector needs to be prepared with <em>v.net operation=connect</em>
+in order to connect points representing center nodes to the network.
+
+<p>
+Points specified by category must be exactly on network nodes, and the
+input vector map needs to be prepared with <em>v.net operation=connect</em>.
+
+<h2>NOTES</h2>
+Arcs can be closed using cost = -1.
+
<h2>EXAMPLE</h2>
Traveling salesman for 6 digitized nodes (Spearfish):
+<p>
+Shortest path, along unimproved roads:
+<p>
+<img src="vnetsalesman.png" alt="v.net.salesman example using distance" border="1">
+
+<p>
+Fastest path, along highways:
+<p>
+<img src="vnetsalesmantime.png" alt="v.net.salesman example using time" border="1">
+
+<p>
+Searching for the shortest path using distance and the fastest path using
+traveling time according to the speed limits of different road types:
+
<div class="code"><pre>
+# Spearfish
+
g.copy vect=roads,myroads
-v.db.addcol myroads col="cost double precision, length double precision"
-# define traveling costs as length in miles divided by speed limit in miles per hour:
-v.to.db map=myroads layer=1 type=line qlayer=1 option=length col=length unit=miles
-v.db.update myroads col=cost val="length / 50"
-v.db.update myroads col=cost val="length / 75" where="label='interstate'"
-v.db.update myroads col=cost val="length / 5" where="label='unimproved road'"
-v.db.update myroads col=cost val="length / 25" where="label='light-duty road, improved surface'"
-v.db.select myroads
-
# we have 6 locations to visit on our trip
echo "1|601653.5|4922869.2|a
2|608284|4923776.6|b
3|601845|4914981.9|c
4|596270|4917456.3|d
5|593330.8|4924096.6|e
-6|598005.5|4921439.2|f" | v.in.ascii cat=1 x=2 y=3 out=centers col="cat integer, \
+6|598005.5|4921439.2|f" | v.in.ascii in=- cat=1 x=2 y=3 out=centers col="cat integer, \
east double precision, north double precision, label varchar(43)"
# verify data preparation
@@ -50,28 +74,66 @@
# type count min max
# point 6 1 5
-# The network is now prepared. Visualize it
+# find the shortest path
+v.net.salesman myroads_net ccats=1-6 out=mysalesman_distance
+
+# set up costs as traveling time
+
+# create unique categories for each road in layer 3
+v.category in=myroads_net out=myroads_net_time opt=add cat=1 layer=3 type=line
+
+# add new table for layer 3
+v.db.addtable myroads_net_time layer=3 col="cat integer,label varchar(43),length double precision,speed double precision,cost double precision,bcost double precision"
+
+# copy road type to layer 3
+v.to.db myroads_net_time layer=3 qlayer=1 opt=query qcolumn=label columns=label
+
+# upload road length in miles
+v.to.db myroads_net_time layer=3 type=line option=length col=length unit=miles
+
+# set speed limits in miles / hour
+v.db.update myroads_net_time layer=3 col=speed val="5.0"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='interstate'"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='primary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="50.0" where="label='secondary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="25.0" where="label='light-duty road, improved surface'"
+v.db.update myroads_net_time layer=3 col=speed val="5.0" where="label='unimproved road'"
+
+# define traveling costs as traveling time in minutes:
+
+# set forward costs
+v.db.update myroads_net_time layer=3 col=cost val="length / speed * 60"
+# set backward costs
+v.db.update myroads_net_time layer=3 col=bcost val="length / speed * 60"
+
+# find the fastest path
+v.net.salesman myroads_net_time alayer=3 nlayer=2 afcol=cost abcol=bcost ccats=1-6 out=mysalesman_time
+</pre></div>
+
+To display the result, run for example:
+
+<div class="code"><pre>
+# Display the results
g.region vect=myroads_net
+
+# shortest path
d.mon x0
d.vect myroads_net
-d.vect -c centers icon=basic/triangle
-d.font verdana
+d.vect centers -c icon=basic/triangle
+d.vect mysalesman_distance col=green width=2
+d.font Vera
d.vect centers col=red disp=attr attrcol=label lsize=12
-# run with traveling costs = length / speed
-v.net.salesman myroads_net acol=cost ccats=1-6 out=mysalesman_speed
-d.vect mysalesman_speed col=green width=2
-
-# run without traveling costs using line length
-v.net.salesman myroads_net ccats=1-6 out=mysalesman_length
-d.vect mysalesman_length col=green width=2
+# fastest path
+d.mon x1
+d.vect myroads_net
+d.vect centers -c icon=basic/triangle
+d.vect mysalesman_time col=green width=2
+d.font Vera
d.vect centers col=red disp=attr attrcol=label lsize=12
</pre></div>
-<img src="vnetsalesman.png" alt="v.net.salesman example" border="1">
-
-
<h2>SEE ALSO</h2>
<em><a HREF="d.path.html">d.path</a></em>,
@@ -84,7 +146,8 @@
<h2>AUTHOR</h2>
Radim Blazek, ITC-Irst, Trento, Italy<br>
-Documentation: Markus Neteler
+Markus Metz<br>
+Documentation: Markus Neteler, Markus Metz
<p><i>Last changed: $Date$</i>
Modified: grass/branches/develbranch_6/vector/v.net.salesman/vnetsalesman.png
===================================================================
(Binary files differ)
Added: grass/branches/develbranch_6/vector/v.net.salesman/vnetsalesmantime.png
===================================================================
(Binary files differ)
Property changes on: grass/branches/develbranch_6/vector/v.net.salesman/vnetsalesmantime.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: grass/branches/develbranch_6/vector/v.net.spanningtree/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.spanningtree/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.spanningtree/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,9 +1,17 @@
<h2>DESCRIPTION</h2>
-<em>v.net.spanningtree</em> find the minimum spanning tree in a network.
+<em>v.net.spanningtree</em> finds the minimum spanning tree in a network.
<h2>NOTES</h2>
-Spanning tree is a minimum cost subnetwork connecting all nodes in a network. Or, if a network is disconnected then the module computes the minimum spanning tree for each (weakly) connected component. So, strictly speaking, module does not compute spanning tree but a spanning forest. As the name suggests spanning tree is a tree. That is, it contains no cycles and if a component has N nodes that the tree has N-1 edges and connected all nodes. <b>Accol</b> is used to specify the costs of the edges. The <b>output</b> consists of the edges in the spanning tree.
+A spanning tree is a minimum cost subnetwork connecting all nodes in a
+network. Or, if a network is disconnected then the module computes the
+minimum spanning tree for each (weakly) connected component. So, strictly
+speaking, <em>v.net.spanningtree</em> does not compute spanning tree but
+a spanning forest. As the name suggests, a spanning tree is a tree. That
+is, it contains no cycles and if a component has N nodes then the tree
+has N-1 edges connecting all nodes. <b>Accol</b> is used to specify the
+costs of the edges. The <b>output</b> consists of the edges in the
+spanning tree.
<h2>EXAMPLES</h2>
Modified: grass/branches/develbranch_6/vector/v.net.steiner/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.steiner/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.steiner/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -10,29 +10,47 @@
which will minimize the amount of fibre optic cable needed to connect
a series of satellite offices.
+<p>
+Costs may be either line lengths, or attributes saved in a database
+table. These attribute values are taken as costs of whole segments, not
+as costs to traverse a length unit (e.g. meter) of the segment.
+For example, if the speed limit is 100 km / h, the cost to traverse a
+10 km long road segment must be calculated as
+length / speed = 10 km / (100 km/h) = 0.1 h.
+Supported are cost assignments for both arcs and nodes.
+For areas, costs will be calculated along boundary lines.
+<p>
+Points representing nodes must be exactly on network nodes, and the
+input vector map needs to be prepared with <em>v.net operation=connect</em>.
+
+
<h2>EXAMPLE</h2>
-Steiner tree for for 6 digitized nodes (Spearfish):
+Steiner tree for 6 digitized nodes (Spearfish):
+<p>
+Shortest path, along unimproved roads:
+<p>
+<img src="vnetsteiner.png" alt="v.net.steiner example using distance" border="1">
+<p>
+Fastest path, along highways:
+<p>
+<img src="vnetsteinertime.png" alt="v.net.steiner example using time" border="1">
+
+
<div class="code"><pre>
+# Spearfish
+
g.copy vect=roads,myroads
-v.db.addcol myroads col="cost double precision"
-# define traveling costs as inverse of speed limit:
-v.db.update myroads col=cost val=1/50
-v.db.update myroads col=cost val=1/75 where="label='interstate'"
-v.db.update myroads col=cost val=1/5 where="label='unimproved road'"
-v.db.update myroads col=cost val=1/25 where="label='light-duty road, improved surface'"
-v.db.select myroads
-
# we have 6 locations to allocate
echo "1|601653.5|4922869.2|a
2|608284|4923776.6|b
3|601845|4914981.9|c
4|596270|4917456.3|d
5|593330.8|4924096.6|e
-6|598005.5|4921439.2|f" | v.in.ascii cat=1 x=2 y=3 out=centers col="cat integer, \
+6|598005.5|4921439.2|f" | v.in.ascii in=- cat=1 x=2 y=3 out=centers col="cat integer, \
east double precision, north double precision, label varchar(43)"
v.db.select centers
@@ -40,33 +58,65 @@
# type count min max
# point 6 1 6
-
-#create lines map connecting points to network (on layer 2)
+# create lines map connecting points to network (on layer 2)
v.net myroads points=centers out=myroads_net op=connect thresh=500
-v.category myroads_net op=report
-# Layer / table: 1 / myroads_net
-# type count min max
-# line 837 1 5
-#
-# Layer: 2
-# type count min max
-# point 6 1 5
-# The network is now prepared.
+# set up costs as traveling time
+
+# create unique categories for each road in layer 3
+v.category in=myroads_net out=myroads_net_time opt=add cat=1 layer=3 type=line
+
+# add new table for layer 3
+v.db.addtable myroads_net_time layer=3 col="cat integer,label varchar(43),length double precision,speed double precision,cost double precision"
+
+# copy road type to layer 3
+v.to.db myroads_net_time layer=3 qlayer=1 opt=query qcolumn=label columns=label
+
+# upload road length in miles
+v.to.db myroads_net_time layer=3 type=line option=length col=length unit=miles
+
+# set speed limits in miles / hour
+v.db.update myroads_net_time layer=3 col=speed val="5.0"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='interstate'"
+v.db.update myroads_net_time layer=3 col=speed val="75.0" where="label='primary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="50.0" where="label='secondary highway, hard surface'"
+v.db.update myroads_net_time layer=3 col=speed val="25.0" where="label='light-duty road, improved surface'"
+v.db.update myroads_net_time layer=3 col=speed val="5.0" where="label='unimproved road'"
+
+# define traveling costs as traveling time in minutes:
+v.db.update myroads_net_time layer=3 col=cost val="length / speed * 60"
+
+# shortest path
+v.net.steiner myroads_net_time alayer=3 nlayer=2 tcats=1-6 out=mysteiner_distance
+
+# fastest path
+v.net.steiner myroads_net_time alayer=3 nlayer=2 acol=cost tcats=1-6 out=mysteiner_time
+</pre></div>
+
+To display the result, run for example:
+
+<div class="code"><pre>
+# display the results
g.region vect=myroads_net
+
+# shortest path
d.mon x0
d.vect myroads_net
d.vect -c centers icon=basic/triangle
-d.font verdana
+d.font Vera
d.vect centers col=red disp=attr attrcol=label lsize=12
+d.vect mysteiner_distance col=blue width=2
-v.net.steiner myroads_net acol=cost tcats=1-6 out=mysteiner
-d.vect mysteiner col=blue width=2
+# fastest path
+d.mon x1
+d.vect myroads_net
+d.vect -c centers icon=basic/triangle
+d.font Vera
+d.vect centers col=red disp=attr attrcol=label lsize=12
+d.vect mysteiner_time col=blue width=2
</pre></div>
-<img src="vnetsteiner.png" alt="v.net.steiner example" border="1">
-
<h2>SEE ALSO</h2>
<em><a HREF="d.path.html">d.path</a></em>,
@@ -79,7 +129,7 @@
<h2>AUTHOR</h2>
Radim Blazek, ITC-Irst, Trento, Italy<br>
-Documentation: Markus Neteler
+Documentation: Markus Neteler, Markus Metz
<p><i>Last changed: $Date$</i>
Modified: grass/branches/develbranch_6/vector/v.net.steiner/vnetsteiner.png
===================================================================
(Binary files differ)
Added: grass/branches/develbranch_6/vector/v.net.steiner/vnetsteinertime.png
===================================================================
(Binary files differ)
Property changes on: grass/branches/develbranch_6/vector/v.net.steiner/vnetsteinertime.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: grass/branches/develbranch_6/vector/v.net.timetable/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.net.timetable/description.html 2011-06-27 07:49:20 UTC (rev 46794)
+++ grass/branches/develbranch_6/vector/v.net.timetable/description.html 2011-06-27 07:50:51 UTC (rev 46795)
@@ -1,12 +1,26 @@
<h2>DESCRIPTION</h2>
-<em>v.net.timetable</em> finds the shortest path between two points using timetables. Module reads input, one query per line, from the standard input and writes output to the standard output as well as to the <b>output</b> map and to tables linked to layers 1 and 2. Each line of input must follow one of the following formats:
+<em>v.net.timetable</em> finds the shortest path between two points
+using timetables. <em>v.net.timetable</em> reads input, one query per
+line, from the standard input and writes output to the standard output
+as well as to the <b>output</b> map and to tables linked to layers 1 and
+2. Each line of input must follow one of the following formats:
<pre>
PATH_ID FROM_X FROM_Y TO_X TO_Y START_TIME MIN_CHANGE MAX_CHANGES WALK_CHANGE
PATH_ID FROM_STOP TO_STOP START_TIME MIN_CHANGE MAX_CHANGES WALK_CHANGE
</pre>
-where PATH_ID is the identificator of a query that is used in the output map to differentiate between queries. Search begins at START_TIME. MIN_CHANGE gives the minimum number of time (inclusively) for a change from one route to another. MAX_CHANGES denotes the maximum number of changes allowed or -1 if infinity. WALK_CHANGE is 1 or 0 depending whether walking from a stop to another stop is considered a change or not. Finally, the path is found from FROM_STOP to TO_STOP in latter case and from the stop closest to (FROM_X, FROM_Y) coordinates to the stop closest to (TO_X, TO_Y) coordinates in former case.<br>
-For each input query, module outputs a description of the shortest path to the standard output. For example, using the tables given below, for the following input:
+where PATH_ID is the identificator of a query that is used in the output
+map to differentiate between queries. Search begins at START_TIME.
+MIN_CHANGE gives the minimum number of time (inclusively) for a change
+from one route to another. MAX_CHANGES denotes the maximum number of
+changes allowed or -1 if infinity. WALK_CHANGE is 1 or 0 depending whether
+walking from a stop to another stop is considered a change or not. Finally,
+the path is found from FROM_STOP to TO_STOP in latter case and from the
+stop closest to (FROM_X, FROM_Y) coordinates to the stop closest to
+(TO_X, TO_Y) coordinates in former case.<br>
+For each input query, module outputs a description of the shortest path
+to the standard output. For example, using the tables given below, for
+the following input:
<div class="code"><pre>
47 130 300 0 1 5 0
</pre></div>
@@ -15,26 +29,59 @@
Route 15, from 130 leaving at 15 arriving to 250 at 22
Walk from 250 leaving at 22 arriving to 300 at 24
</pre></div>
-Moreover, the module writes the path to the <b>output</b> map and stores all the information necesasary to reconstruct the path to the tables. Table corresponding to stops/points is linked to layer 1 and looks, after the query, as follows:
+Moreover, the module writes the path to the <b>output</b> map and stores
+all the information necesasary to reconstruct the path to the tables.
+Table corresponding to stops/points is linked to layer 1 and looks,
+after the query, as follows:
<div class="code"><pre>
cat|path_id|stop_id|index|arr_time|dep_time
1|47|130|1|0|15
2|47|250|2|22|22
3|47|300|3|24|24
</pre></div>
-where CAT is the category of a point in the map, PATH_ID is the path identificator, STOP_ID is the identificator of the stop as used in the intput map, INDEX is the index of the stop on the path (i.e, index=1 is the first stop visited, ...) and ARR_TIME and DEP_TIME denote the arrival time and departure time respectively. Arrival time for the first stop on the path is always equal to START_TIME and departure time for the last stop is always equal to the arrival time.<br>
-Table linked to the second layer corresponds to subroutes taken between stops. The following table is obtainedd for the above query:
+where CAT is the category of a point in the map, PATH_ID is the path
+identificator, STOP_ID is the identificator of the stop as used in the
+input map, INDEX is the index of the stop on the path (i.e, index=1 is
+the first stop visited, ...) and ARR_TIME and DEP_TIME denote the arrival
+time and departure time respectively. Arrival time for the first stop on
+the path is always equal to START_TIME and departure time for the last
+stop is always equal to the arrival time.<br>
+Table linked to the second layer corresponds to subroutes taken between
+stops. The following table is obtainedd for the above query:
<div class="code"><pre>
cat|path_id|from_id|to_id|route_id|index|from_time|to_time
1|47|130|250|15|1|15|22
2|47|250|300|-1|2|22|24
</pre></div>
-where CAT is the category of lines of subroute between stops FROM_ID to TO_ID, ROUTE_ID is the identificator of the route taken or -1 if walking, INDEX and PATH_ID are as above and FROM_TIME and TO_TIME denote the times between which the route is taken.<br>
-The <b>output</b> map contains the points on the positions of used stops. If a subroute is taken between two stops then a line segment is added between two corresponding points. Finally, instead of straight line segment, the actual paths of routes can be given in <b>paths</b> layer. If this parameter is used then each line in the input map must contain identificators as category numbers of all routes passing through the line. The module then finds the path between two stops and writes this path instead. In case of walking from one stop to another, straight line between the stops is used.
+where CAT is the category of lines of subroute between stops FROM_ID to
+TO_ID, ROUTE_ID is the identificator of the route taken or -1 if walking,
+INDEX and PATH_ID are as above and FROM_TIME and TO_TIME denote the times
+between which the route is taken.<br>
+The <b>output</b> map contains the points on the positions of used stops.
+If a subroute is taken between two stops then a line segment is added
+between two corresponding points. Finally, instead of straight line
+segment, the actual paths of routes can be given in <b>paths</b> layer.
+If this parameter is used then each line in the input map must contain
+identificators as category numbers of all routes passing through the line.
+The module then finds the path between two stops and writes this path
+instead. In case of walking from one stop to another, straight line
+between the stops is used.
<h2>NOTES</h2>
-Timetables are stored in a table linked to the given <b>layer</b> of the <b>input</b> map. Timetable consists of routes and each route is just a sequence of stops with specified arrival times. If two sequences of stops differ only in times then they still correspond to two routes. For example, if there is a bus line that leaves every 20 minutes and follow exactly the same path every time then there still needs to be a separate route for every time. For each stop (given by the category number of the point) the table storing information about the routes must contain the list of all routes stopping at the stop(given by route identificators) together with arrival times. That is, the table must contain three columns: stop - which is the key of the table, <b>route_id</b> and <b>stop_time</b> where each triple corresponds to a route arriving to a stop and a certain time. For example, a valid table might look as follows:
+Timetables are stored in a table linked to the given <b>layer</b> of the
+<b>input</b> map. Timetable consists of routes and each route is just a
+sequence of stops with specified arrival times. If two sequences of stops
+differ only in times then they still correspond to two routes. For
+example, if there is a bus line that leaves every 20 minutes and follow
+exactly the same path every time then there still needs to be a separate
+route for every time. For each stop (given by the category number of the
+point) the table storing information about the routes must contain the
+list of all routes stopping at the stop(given by route identificators)
+together with arrival times. That is, the table must contain three
+columns: stop - which is the key of the table, <b>route_id</b> and
+<b>stop_time</b> where each triple corresponds to a route arriving to a
+stop and a certain time. For example, a valid table might look as follows:
<div class="code"><pre>
cat|route_id|stop_time
100|5|0
@@ -50,22 +97,34 @@
300|35|37
100|35|50
</pre></div>
-Note that <b>stop_time</b> is an integer and so you can use any units and offest to specify arrival times.<br>
-Also, walking connections between stops can be given by a table linked to <b>walking</b> layer of the <b>input</b> map. If this parameter is -1 then walking between stops is not allowed. The table must contain three columns: stop - which is the key of the table, <b>to_stop</b> and <b>length</b>. A record in the table says that it takes <b>lenght</b> units of time to walk from stop to <b>to_stop</b>. The following is a valid table:
+Note that <b>stop_time</b> is an integer and so you can use any units and
+offest to specify arrival times.<br>
+Also, walking connections between stops can be given by a table linked to
+<b>walking</b> layer of the <b>input</b> map. If this parameter is -1
+then walking between stops is not allowed. The table must contain three
+columns: stop - which is the key of the table, <b>to_stop</b> and
+<b>length</b>. A record in the table says that it takes <b>length</b>
+units of time to walk from stop to <b>to_stop</b>. The following is a
+valid table:
<div class="code"><pre>
cat|length|to_stop
250|2|300
</pre></div>
-Beware that this only means that it is possible to walk from stop 250 to stop 300 but the other way round.
+Beware that this only means that it is possible to walk from stop 250 to
+stop 300 but not the other way round.
<h2>EXAMPLES</h2>
-To find a path from stop with identificator 130 to stop with category 300, starting at time 0, with one time unit for change, maximum of 5 changes and with walking not considered a change of route, we use the following command:
+To find a path from stop with identificator 130 to stop with category 300,
+starting at time 0, with one time unit for change, maximum of 5 changes
+and with walking not considered a change of route, we use the following
+command:
<div class="code"><pre>
echo "47 130 300 0 1 5 0" | v.net.timetable input=buses output=path layer=5 walking=6 path=7
</pre></div>
-If on the other, hand we know the coordinates of the places then the following command might be used
+If on the other, hand we know the coordinates of the places then the
+following command might be used
<div class="code"><pre>
echo "47 10.31 54.31 90.21 28.21 0 1 5 0" | v.net.timetable input=buses output=path layer=5 walking=6 path=7
</pre></div>
More information about the grass-commit
mailing list