[GRASS-SVN] r46796 - in grass/branches/releasebranch_6_4/vector: v.net.alloc v.net.iso v.net.path v.net.salesman v.net.steiner

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 27 03:51:37 EDT 2011


Author: mmetz
Date: 2011-06-27 00:51:37 -0700 (Mon, 27 Jun 2011)
New Revision: 46796

Added:
   grass/branches/releasebranch_6_4/vector/v.net.alloc/v_net_alloc_time.png
   grass/branches/releasebranch_6_4/vector/v.net.iso/vnetisotime.png
   grass/branches/releasebranch_6_4/vector/v.net.salesman/vnetsalesmantime.png
   grass/branches/releasebranch_6_4/vector/v.net.steiner/vnetsteinertime.png
Modified:
   grass/branches/releasebranch_6_4/vector/v.net.alloc/description.html
   grass/branches/releasebranch_6_4/vector/v.net.iso/description.html
   grass/branches/releasebranch_6_4/vector/v.net.iso/vnetiso.png
   grass/branches/releasebranch_6_4/vector/v.net.path/description.html
   grass/branches/releasebranch_6_4/vector/v.net.path/vnetpath.png
   grass/branches/releasebranch_6_4/vector/v.net.salesman/description.html
   grass/branches/releasebranch_6_4/vector/v.net.salesman/vnetsalesman.png
   grass/branches/releasebranch_6_4/vector/v.net.steiner/description.html
   grass/branches/releasebranch_6_4/vector/v.net.steiner/vnetsteiner.png
Log:
update documentation

Modified: grass/branches/releasebranch_6_4/vector/v.net.alloc/description.html
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.net.alloc/description.html	2011-06-27 07:50:51 UTC (rev 46795)
+++ grass/branches/releasebranch_6_4/vector/v.net.alloc/description.html	2011-06-27 07:51:37 UTC (rev 46796)
@@ -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 &gt;= 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 &gt;= 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/releasebranch_6_4/vector/v.net.alloc/v_net_alloc_time.png
===================================================================
(Binary files differ)


Property changes on: grass/branches/releasebranch_6_4/vector/v.net.alloc/v_net_alloc_time.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Modified: grass/branches/releasebranch_6_4/vector/v.net.iso/description.html
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.net.iso/description.html	2011-06-27 07:50:51 UTC (rev 46795)
+++ grass/branches/releasebranch_6_4/vector/v.net.iso/description.html	2011-06-27 07:51:37 UTC (rev 46796)
@@ -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 &gt;= 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/releasebranch_6_4/vector/v.net.iso/vnetiso.png
===================================================================
(Binary files differ)

Added: grass/branches/releasebranch_6_4/vector/v.net.iso/vnetisotime.png
===================================================================
(Binary files differ)


Property changes on: grass/branches/releasebranch_6_4/vector/v.net.iso/vnetisotime.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Modified: grass/branches/releasebranch_6_4/vector/v.net.path/description.html
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.net.path/description.html	2011-06-27 07:50:51 UTC (rev 46795)
+++ grass/branches/releasebranch_6_4/vector/v.net.path/description.html	2011-06-27 07:51:37 UTC (rev 46796)
@@ -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/releasebranch_6_4/vector/v.net.path/vnetpath.png
===================================================================
(Binary files differ)

Modified: grass/branches/releasebranch_6_4/vector/v.net.salesman/description.html
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.net.salesman/description.html	2011-06-27 07:50:51 UTC (rev 46795)
+++ grass/branches/releasebranch_6_4/vector/v.net.salesman/description.html	2011-06-27 07:51:37 UTC (rev 46796)
@@ -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,62 @@
 # 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"
+
+# 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"
+
+# find the fastest path
+v.net.salesman myroads_net_time alayer=3 nlayer=2 acol=cost 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 +142,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/releasebranch_6_4/vector/v.net.salesman/vnetsalesman.png
===================================================================
(Binary files differ)

Added: grass/branches/releasebranch_6_4/vector/v.net.salesman/vnetsalesmantime.png
===================================================================
(Binary files differ)


Property changes on: grass/branches/releasebranch_6_4/vector/v.net.salesman/vnetsalesmantime.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Modified: grass/branches/releasebranch_6_4/vector/v.net.steiner/description.html
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.net.steiner/description.html	2011-06-27 07:50:51 UTC (rev 46795)
+++ grass/branches/releasebranch_6_4/vector/v.net.steiner/description.html	2011-06-27 07:51:37 UTC (rev 46796)
@@ -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/releasebranch_6_4/vector/v.net.steiner/vnetsteiner.png
===================================================================
(Binary files differ)

Added: grass/branches/releasebranch_6_4/vector/v.net.steiner/vnetsteinertime.png
===================================================================
(Binary files differ)


Property changes on: grass/branches/releasebranch_6_4/vector/v.net.steiner/vnetsteinertime.png
___________________________________________________________________
Added: svn:mime-type
   + image/png



More information about the grass-commit mailing list