[GRASS-SVN] r38775 - in grass-addons/vector/net.analyze: netalib v.net.allpairs v.net.bridge v.net.centrality v.net.components v.net.connectivity v.net.distance v.net.flow v.net.spanningtree v.net.timetable

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 17 13:24:05 EDT 2009


Author: dano
Date: 2009-08-17 13:24:05 -0400 (Mon, 17 Aug 2009)
New Revision: 38775

Added:
   grass-addons/vector/net.analyze/v.net.connectivity/description.html
   grass-addons/vector/net.analyze/v.net.distance/description.html
   grass-addons/vector/net.analyze/v.net.spanningtree/description.html
   grass-addons/vector/net.analyze/v.net.timetable/description.html
Removed:
   grass-addons/vector/net.analyze/v.net.spanningtree/v.net.spanningtree.tmp.html
Modified:
   grass-addons/vector/net.analyze/netalib/neta.h
   grass-addons/vector/net.analyze/netalib/timetables.c
   grass-addons/vector/net.analyze/v.net.allpairs/description.html
   grass-addons/vector/net.analyze/v.net.bridge/description.html
   grass-addons/vector/net.analyze/v.net.bridge/main.c
   grass-addons/vector/net.analyze/v.net.centrality/description.html
   grass-addons/vector/net.analyze/v.net.components/description.html
   grass-addons/vector/net.analyze/v.net.components/main.c
   grass-addons/vector/net.analyze/v.net.connectivity/main.c
   grass-addons/vector/net.analyze/v.net.distance/main.c
   grass-addons/vector/net.analyze/v.net.flow/description.html
   grass-addons/vector/net.analyze/v.net.flow/main.c
   grass-addons/vector/net.analyze/v.net.spanningtree/main.c
   grass-addons/vector/net.analyze/v.net.timetable/main.c
Log:
Minor bux fixes and new documentation

Modified: grass-addons/vector/net.analyze/netalib/neta.h
===================================================================
--- grass-addons/vector/net.analyze/netalib/neta.h	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/netalib/neta.h	2009-08-17 17:24:05 UTC (rev 38775)
@@ -100,9 +100,9 @@
     int **prev_conn;
     int rows, routes;
 } neta_timetable_result;
-
 int neta_init_timetable_from_db(struct Map_info *In, int route_layer,
 				int walk_layer, char *route_id, char *times,
+				char *to_stop, char *walk_length,
 				neta_timetable * timetable, int **route_ids,
 				int **stop_ids);
 int neta_timetable_shortest_path(neta_timetable * timetable, int from_stop,

Modified: grass-addons/vector/net.analyze/netalib/timetables.c
===================================================================
--- grass-addons/vector/net.analyze/netalib/timetables.c	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/netalib/timetables.c	2009-08-17 17:24:05 UTC (rev 38775)
@@ -90,6 +90,7 @@
 /*Initialises timetable from a database. Returns 0 on success */
 int neta_init_timetable_from_db(struct Map_info *In, int route_layer,
 				int walk_layer, char *route_id, char *times,
+				char *to_stop, char *walk_length,
 				neta_timetable * timetable, int **route_ids,
 				int **stop_ids)
 {
@@ -205,7 +206,8 @@
     if (walk_layer != -1) {
 
 	Fi = Vect_get_field(In, walk_layer);
-	sprintf(buf, "select * from %s", Fi->table);
+	sprintf(buf, "select %s, %s, %s from %s", Fi->key, to_stop, walk_length,
+		Fi->table);
 	db_set_string(&sql, buf);
 
 	if (db_open_select_cursor(driver, &sql, &cursor, DB_SEQUENTIAL) !=

Modified: grass-addons/vector/net.analyze/v.net.allpairs/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.allpairs/description.html	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.allpairs/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -22,6 +22,7 @@
 <em>
 <a HREF="v.net.path">v.net.path</a>,
 <a HREF="v.net.distance">v.net.distance</a>
+</em>
 
 
 <h2>AUTHORS</h2>

Modified: grass-addons/vector/net.analyze/v.net.bridge/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.bridge/description.html	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.bridge/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -23,8 +23,8 @@
 
 <em>
 <a HREF="v.category.html">v.category</a>,
+</em>
 
-
 <h2>AUTHORS</h2>
 
 Daniel Bundala, Google Summer of Code 2009, Student<br>

Modified: grass-addons/vector/net.analyze/v.net.bridge/main.c
===================================================================
--- grass-addons/vector/net.analyze/v.net.bridge/main.c	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.bridge/main.c	2009-08-17 17:24:05 UTC (rev 38775)
@@ -31,10 +31,9 @@
     char *mapset;
     struct GModule *module;	/* GRASS module for parsing arguments */
     struct Option *map_in, *map_out;
-    struct Option *cat_opt, *field_opt, *where_opt, *method_opt;
-    int chcat, with_z;
+    struct Option *field_opt, *method_opt;
+    int with_z;
     int layer, mask_type;
-    VARRAY *varray;
     dglGraph_s *graph;
     int i, bridges, articulations;
     struct ilist *bridge_list, *articulation_list;
@@ -52,8 +51,6 @@
     map_out = G_define_standard_option(G_OPT_V_OUTPUT);
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    cat_opt = G_define_standard_option(G_OPT_V_CATS);
-    where_opt = G_define_standard_option(G_OPT_WHERE);
 
     method_opt = G_define_option();
     method_opt->key = "method";
@@ -96,10 +93,6 @@
 
     /* parse filter option and select appropriate lines */
     layer = atoi(field_opt->answer);
-    chcat =
-	(neta_initialise_varray
-	 (&In, layer, mask_type, where_opt->answer, cat_opt->answer,
-	  &varray) == 1);
 
     Vect_net_build_graph(&In, mask_type, 0, 0, NULL, NULL, NULL, 0, 0);
     graph = &(In.graph);

Modified: grass-addons/vector/net.analyze/v.net.centrality/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.centrality/description.html	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.centrality/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -22,8 +22,8 @@
 
 <em>
 <a HREF="v.generalize.html">v.generalize</a>
+</em>
 
-
 <h2>AUTHORS</h2>
 
 Daniel Bundala, Google Summer of Code 2009, Student<br>

Modified: grass-addons/vector/net.analyze/v.net.components/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.components/description.html	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.components/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -24,8 +24,8 @@
 
 <em>
 <a HREF="v.category.html">v.category</a>,
+</em>
 
-
 <h2>AUTHORS</h2>
 
 Daniel Bundala, Google Summer of Code 2009, Student<br>

Modified: grass-addons/vector/net.analyze/v.net.components/main.c
===================================================================
--- grass-addons/vector/net.analyze/v.net.components/main.c	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.components/main.c	2009-08-17 17:24:05 UTC (rev 38775)
@@ -48,11 +48,10 @@
     char *mapset;
     struct GModule *module;	/* GRASS module for parsing arguments */
     struct Option *map_in, *map_out;
-    struct Option *cat_opt, *field_opt, *where_opt, *method_opt;
+    struct Option *field_opt, *method_opt;
     struct Flag *add_f;
-    int chcat, with_z;
+    int with_z;
     int layer, mask_type;
-    VARRAY *varray;
     dglGraph_s *graph;
     int *component, nnodes, type, i, nlines, components, j, max_cat;
     char buf[2000], *covered;
@@ -76,8 +75,6 @@
     map_out = G_define_standard_option(G_OPT_V_OUTPUT);
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    cat_opt = G_define_standard_option(G_OPT_V_CATS);
-    where_opt = G_define_standard_option(G_OPT_WHERE);
 
     method_opt = G_define_option();
     method_opt->key = "method";
@@ -124,10 +121,6 @@
 
     /* parse filter option and select appropriate lines */
     layer = atoi(field_opt->answer);
-    chcat =
-	(neta_initialise_varray
-	 (&In, layer, mask_type, where_opt->answer, cat_opt->answer,
-	  &varray) == 1);
 
     Vect_net_build_graph(&In, mask_type, 0, 0, NULL, NULL, NULL, 0, 0);
     graph = &(In.graph);
@@ -223,7 +216,7 @@
 	for (i = 1; i <= nnodes; i++)
 	    if (!covered[i]) {
 		Vect_reset_cats(Cats);
-		Vect_cat_set(Cats, 1, max_cat);
+		Vect_cat_set(Cats, layer, max_cat);
 		neta_add_point_on_node(&In, &Out, i, Cats);
 		insert_new_record(driver, Fi, &sql, max_cat++, component[i]);
 	    }

Added: grass-addons/vector/net.analyze/v.net.connectivity/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.connectivity/description.html	                        (rev 0)
+++ grass-addons/vector/net.analyze/v.net.connectivity/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -0,0 +1,33 @@
+<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. 
+
+<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.
+
+<h2>EXAMPLES</h2>
+The following command finds the minimum number of intersection 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>
+<P>
+
+<div class="code"><pre>
+v.net.connectivity input=airtraffic output=connectivity set1_where="name=JFK" set2_where="name=Heathrow" ncolumn=capacity
+</pre></div>
+
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a HREF="v.net.flow.html">v.net.flow</a>,
+<a HREF="v.net.bridge.html">v.net.bridge</a>
+</em>
+
+<h2>AUTHORS</h2>
+
+Daniel Bundala, Google Summer of Code 2009, Student<br>
+Wolf Bergenheim, Mentor
+
+<p>
+<i>Last changed: $Date: 2009-07-28 21:04:57 +0200 (Tue, 28 July 2009) $</i>


Property changes on: grass-addons/vector/net.analyze/v.net.connectivity/description.html
___________________________________________________________________
Added: svn:executable
   + *

Modified: grass-addons/vector/net.analyze/v.net.connectivity/main.c
===================================================================
--- grass-addons/vector/net.analyze/v.net.connectivity/main.c	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.connectivity/main.c	2009-08-17 17:24:05 UTC (rev 38775)
@@ -33,12 +33,11 @@
     char *mapset;
     struct GModule *module;	/* GRASS module for parsing arguments */
     struct Option *map_in, *map_out;
-    struct Option *cat_opt, *field_opt, *where_opt, *ncol;
+    struct Option *field_opt, *ncol;
     struct Option *catset1_opt, *fieldset1_opt, *whereset1_opt;
     struct Option *catset2_opt, *fieldset2_opt, *whereset2_opt;
-    int chcat, with_z;
+    int with_z;
     int layer, mask_type;
-    VARRAY *varray;
     VARRAY *varray_set1, *varray_set2;
     dglGraph_s *graph;
     int i, nnodes, nlines, *flow, total_flow, nedges;
@@ -61,8 +60,6 @@
     map_out = G_define_standard_option(G_OPT_V_OUTPUT);
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    cat_opt = G_define_standard_option(G_OPT_V_CATS);
-    where_opt = G_define_standard_option(G_OPT_WHERE);
 
     ncol = G_define_option();
     ncol->key = "ncolumn";
@@ -122,10 +119,6 @@
 
     /* parse filter option and select appropriate lines */
     layer = atoi(field_opt->answer);
-    chcat =
-	(neta_initialise_varray
-	 (&In, layer, mask_type, where_opt->answer, cat_opt->answer,
-	  &varray) == 1);
 
     if (neta_initialise_varray
 	(&In, atoi(fieldset1_opt->answer), GV_POINT, whereset1_opt->answer,

Added: grass-addons/vector/net.analyze/v.net.distance/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.distance/description.html	                        (rev 0)
+++ grass-addons/vector/net.analyze/v.net.distance/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -0,0 +1,33 @@
+<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>. 
+
+<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 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.
+<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
+</pre></div>
+<P>
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a HREF="v.net.path.html">v.net.path</a>,
+<a HREF="v.net.allpairs.html">v.net.allpairs</a>,
+<a HREF="v.distance.html">v.net.distance</a>,
+<a HREF="v.net.alloc.html">v.net.alloc</a>
+</em>
+
+<h2>AUTHORS</h2>
+
+Daniel Bundala, Google Summer of Code 2009, Student<br>
+Wolf Bergenheim, Mentor
+
+<p>
+<i>Last changed: $Date: 2009-07-28 21:04:57 +0200 (Tue, 28 July 2009) $</i>


Property changes on: grass-addons/vector/net.analyze/v.net.distance/description.html
___________________________________________________________________
Added: svn:executable
   + *

Modified: grass-addons/vector/net.analyze/v.net.distance/main.c
===================================================================
--- grass-addons/vector/net.analyze/v.net.distance/main.c	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.distance/main.c	2009-08-17 17:24:05 UTC (rev 38775)
@@ -34,7 +34,7 @@
     struct GModule *module;	/* GRASS module for parsing arguments */
     struct Option *map_in, *map_out, *abcol, *afcol;
     struct Option *catf_opt, *fieldf_opt, *wheref_opt;
-    struct Option *catt_opt, *fieldt_opt, *wheret_opt;
+    struct Option *catt_opt, *fieldt_opt, *wheret_opt, *to_type_opt;
     struct Flag *geo_f;
     int with_z, geo;
     int mask_type;
@@ -89,6 +89,12 @@
     wheret_opt->description =
 	_("To WHERE conditions of SQL statement without 'where' keyword");
 
+    to_type_opt = G_define_standard_option(G_OPT_V_TYPE);
+    to_type_opt->key = "to_type";
+    to_type_opt->options = "point,line,boundary";
+    to_type_opt->answer = "point";
+    to_type_opt->label = _("To feature type");
+
     afcol = G_define_option();
     afcol->key = "afcolumn";
     afcol->type = TYPE_STRING;
@@ -110,8 +116,7 @@
     /* options and flags parser */
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
-    /* TODO: make an option for this */
-    mask_type = GV_POINT | GV_LINE | GV_BOUNDARY;
+    mask_type = Vect_option_to_types(to_type_opt);
 
     Points = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();

Modified: grass-addons/vector/net.analyze/v.net.flow/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.flow/description.html	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.flow/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -25,6 +25,7 @@
 
 <em>
 <a HREF="v.net.connectivity.html">v.net.connectivity</a>
+</em>
 
 
 <h2>AUTHORS</h2>

Modified: grass-addons/vector/net.analyze/v.net.flow/main.c
===================================================================
--- grass-addons/vector/net.analyze/v.net.flow/main.c	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.flow/main.c	2009-08-17 17:24:05 UTC (rev 38775)
@@ -33,12 +33,11 @@
     char *mapset;
     struct GModule *module;	/* GRASS module for parsing arguments */
     struct Option *map_in, *map_out, *cut_out;
-    struct Option *cat_opt, *field_opt, *where_opt, *abcol, *afcol;
+    struct Option *field_opt, *abcol, *afcol;
     struct Option *catsource_opt, *fieldsource_opt, *wheresource_opt;
     struct Option *catsink_opt, *fieldsink_opt, *wheresink_opt;
-    int chcat, with_z;
+    int with_z;
     int layer, mask_type;
-    VARRAY *varray;
     VARRAY *varray_source, *varray_sink;
     dglGraph_s *graph;
     int i, nlines, *flow, total_flow;
@@ -72,8 +71,6 @@
     cut_out->description = _("Name of output map containing a minimum cut");
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    cat_opt = G_define_standard_option(G_OPT_V_CATS);
-    where_opt = G_define_standard_option(G_OPT_WHERE);
 
     afcol = G_define_option();
     afcol->key = "afcolumn";
@@ -148,10 +145,6 @@
 
     /* parse filter option and select appropriate lines */
     layer = atoi(field_opt->answer);
-    chcat =
-	(neta_initialise_varray
-	 (&In, layer, mask_type, where_opt->answer, cat_opt->answer,
-	  &varray) == 1);
 
     /* Create table */
     Fi = Vect_default_field_info(&Out, 1, NULL, GV_1TABLE);

Added: grass-addons/vector/net.analyze/v.net.spanningtree/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.spanningtree/description.html	                        (rev 0)
+++ grass-addons/vector/net.analyze/v.net.spanningtree/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -0,0 +1,28 @@
+<h2>DESCRIPTION</h2>
+
+<em>v.net.spanningtree</em> find 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.  
+
+<h2>EXAMPLES</h2>
+
+Find cheapest set of pipelines connecting all nodes.
+<div class="code"><pre>
+v.net.spanningtree input=projected_pipelines output=spanningtree accol=cost 
+</pre></div>
+<P>
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a HREF="v.net.steiner.html">v.net.steiner</a>
+</em>
+
+<h2>AUTHORS</h2>
+
+Daniel Bundala, Google Summer of Code 2009, Student<br>
+Wolf Bergenheim, Mentor
+
+<p>
+<i>Last changed: $Date: 2009-07-28 21:04:57 +0200 (Tue, 28 July 2009) $</i>


Property changes on: grass-addons/vector/net.analyze/v.net.spanningtree/description.html
___________________________________________________________________
Added: svn:executable
   + *

Modified: grass-addons/vector/net.analyze/v.net.spanningtree/main.c
===================================================================
--- grass-addons/vector/net.analyze/v.net.spanningtree/main.c	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.spanningtree/main.c	2009-08-17 17:24:05 UTC (rev 38775)
@@ -31,11 +31,10 @@
     char *mapset;
     struct GModule *module;	/* GRASS module for parsing arguments */
     struct Option *map_in, *map_out;
-    struct Option *cat_opt, *field_opt, *where_opt, *accol;
+    struct Option *field_opt, *accol;
     struct Flag *geo_f;
-    int chcat, with_z;
+    int with_z;
     int layer, mask_type;
-    VARRAY *varray;
     dglGraph_s *graph;
     int i, edges, geo;
     struct ilist *tree_list;
@@ -53,8 +52,6 @@
     map_out = G_define_standard_option(G_OPT_V_OUTPUT);
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    cat_opt = G_define_standard_option(G_OPT_V_CATS);
-    where_opt = G_define_standard_option(G_OPT_WHERE);
 
     accol = G_define_option();
     accol->key = "accol";
@@ -105,12 +102,8 @@
 
     /* parse filter option and select appropriate lines */
     layer = atoi(field_opt->answer);
-    chcat =
-	(neta_initialise_varray
-	 (&In, layer, mask_type, where_opt->answer, cat_opt->answer,
-	  &varray) == 1);
 
-    Vect_net_build_graph(&In, mask_type, atoi(field_opt->answer), 0,
+    Vect_net_build_graph(&In, mask_type, layer, 0,
 			 accol->answer, NULL, NULL, geo, 0);
     graph = &(In.graph);
 

Deleted: grass-addons/vector/net.analyze/v.net.spanningtree/v.net.spanningtree.tmp.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.spanningtree/v.net.spanningtree.tmp.html	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.spanningtree/v.net.spanningtree.tmp.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -1,91 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title>GRASS GIS manual: v.net.spanningtree</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="grassdocs.css" type="text/css">
-</head>
-<body bgcolor="white">
-
-<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
-
-<h2>NAME</h2>
-<em><b>v.net.spanningtree</b></em>  - Computes minimum spanning tree.
-<h2>KEYWORDS</h2>
-network, spanning tree
-<h2>SYNOPSIS</h2>
-<b>v.net.spanningtree</b><br>
-<b>v.net.spanningtree help</b><br>
-<b>v.net.spanningtree</b> [-<b>g</b>] <b>input</b>=<em>name</em> <b>output</b>=<em>name</em>  [<b>layer</b>=<em>integer</em>]   [<b>cats</b>=<em>range</em>]   [<b>where</b>=<em>sql_query</em>]   [<b>accol</b>=<em>string</em>]   [--<b>overwrite</b>]  [--<b>verbose</b>]  [--<b>quiet</b>] 
-
-<h3>Flags:</h3>
-<DL>
-<DT><b>-g</b></DT>
-<DD>Use geodesic calculation for longitude-latitude locations</DD>
-
-<DT><b>--overwrite</b></DT>
-<DD>Allow output files to overwrite existing files</DD>
-<DT><b>--verbose</b></DT>
-<DD>Verbose module output</DD>
-<DT><b>--quiet</b></DT>
-<DD>Quiet module output</DD>
-</DL>
-
-<h3>Parameters:</h3>
-<DL>
-<DT><b>input</b>=<em>name</em></DT>
-<DD>Name of input vector map</DD>
-
-<DT><b>output</b>=<em>name</em></DT>
-<DD>Name for output vector map</DD>
-
-<DT><b>layer</b>=<em>integer</em></DT>
-<DD>Layer number</DD>
-<DD>A single vector map can be connected to multiple database tables. This number determines which table to use.</DD>
-<DD>Default: <em>1</em></DD>
-
-<DT><b>cats</b>=<em>range</em></DT>
-<DD>Category values</DD>
-<DD>Example: 1,3,7-9,13</DD>
-
-<DT><b>where</b>=<em>sql_query</em></DT>
-<DD>WHERE conditions of SQL statement without 'where' keyword</DD>
-<DD>Example: income &lt; 1000 and inhab &gt;= 10000</DD>
-
-<DT><b>accol</b>=<em>string</em></DT>
-<DD>Arc cost column</DD>
-
-</DL>
-<h2>DESCRIPTION</h2>
-
-<em>v.net.spanningtree</em> find 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, srictly speaking, module dos 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.  
-
-<h2>EXAMPLES</h2>
-
-Find cheapest set of pipelines connecting all nodes.
-<div class="code"><pre>
-v.net.spanningtree input=projected_pipelines output=spanningtree accol=cost 
-</pre></div>
-<P>
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a HREF="v.net.steiner.html">v.net.steiner</a>
-
-
-<h2>AUTHORS</h2>
-
-Daniel Bundala, Google Summer of Code 2009, Student<br>
-Wolf Bergenheim, Mentor
-
-<p>
-<i>Last changed: $Date: 2009-07-28 21:04:57 +0200 (Tue, 28 July 2009) $</i>
-<HR>
-<P><a href="index.html">Main index</a> - <a href="vector.html">vector index</a> - <a href="full_index.html">Full index</a></P>
-<P>&copy; 2003-2009 <a href="http://grass.osgeo.org">GRASS Development Team</a></p>
-</body>
-</html>

Added: grass-addons/vector/net.analyze/v.net.timetable/description.html
===================================================================
--- grass-addons/vector/net.analyze/v.net.timetable/description.html	                        (rev 0)
+++ grass-addons/vector/net.analyze/v.net.timetable/description.html	2009-08-17 17:24:05 UTC (rev 38775)
@@ -0,0 +1,86 @@
+<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:
+<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:
+<div class="code"><pre>
+47 130 300 0 1 5 0
+</pre></div>
+the following output is produced:
+<div class="code"><pre>
+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:
+<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:
+<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.    
+
+<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:           
+<div class="code"><pre>
+cat|route_id|stop_time
+100|5|0
+130|5|10
+150|5|20
+250|5|30
+300|5|40
+260|15|5
+130|15|15
+250|15|22
+150|35|17
+250|35|27
+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:
+<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.
+
+<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:
+<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   
+<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>
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a HREF="v.net.path.html">v.net.path</a>,
+<a HREF="v.net.distance.html">v.net.distance</a>
+</em>
+
+<h2>AUTHORS</h2>
+
+Daniel Bundala, Google Summer of Code 2009, Student<br>
+Wolf Bergenheim, Mentor
+
+<p>
+<i>Last changed: $Date: 2009-07-28 21:04:57 +0200 (Tue, 28 July 2009) $</i>


Property changes on: grass-addons/vector/net.analyze/v.net.timetable/description.html
___________________________________________________________________
Added: svn:executable
   + *

Modified: grass-addons/vector/net.analyze/v.net.timetable/main.c
===================================================================
--- grass-addons/vector/net.analyze/v.net.timetable/main.c	2009-08-17 13:32:31 UTC (rev 38774)
+++ grass-addons/vector/net.analyze/v.net.timetable/main.c	2009-08-17 17:24:05 UTC (rev 38775)
@@ -220,11 +220,10 @@
     char *mapset;
     struct GModule *module;	/* GRASS module for parsing arguments */
     struct Option *map_in, *map_out;
-    struct Option *cat_opt, *field_opt, *where_opt, *walk_layer_opt,
-	*path_layer_opt;
-    int chcat, with_z;
+    struct Option *field_opt, *walk_layer_opt, *path_layer_opt, *route_id_opt,
+	*stop_time_opt, *to_stop_opt, *walk_length_opt;
+    int with_z;
     int layer, mask_type, path_layer;
-    VARRAY *varray;
     int from_stop, to_stop, start_time, min_change, max_changes, walking_change,
 	ret;
     int *stop_pnt, i, nlines, point_counter, *route_pnt;
@@ -249,8 +248,6 @@
     map_out = G_define_standard_option(G_OPT_V_OUTPUT);
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    cat_opt = G_define_standard_option(G_OPT_V_CATS);
-    where_opt = G_define_standard_option(G_OPT_WHERE);
 
     walk_layer_opt = G_define_standard_option(G_OPT_V_FIELD);
     walk_layer_opt->key = "walking";
@@ -262,7 +259,34 @@
     path_layer_opt->answer = "-1";
     path_layer_opt->description = _("Layer with route paths or -1");
 
+    route_id_opt = G_define_option();
+    route_id_opt->key = "route_id";
+    route_id_opt->type = TYPE_STRING;
+    route_id_opt->required = YES;
+    route_id_opt->answer = "route_id";
+    route_id_opt->description = _("route_id column name");
 
+    stop_time_opt = G_define_option();
+    stop_time_opt->key = "stop_time";
+    stop_time_opt->type = TYPE_STRING;
+    stop_time_opt->required = YES;
+    stop_time_opt->answer = "stop_time";
+    stop_time_opt->description = _("stop_time column name");
+
+    to_stop_opt = G_define_option();
+    to_stop_opt->key = "to_stop";
+    to_stop_opt->type = TYPE_STRING;
+    to_stop_opt->required = YES;
+    to_stop_opt->answer = "to_stop";
+    to_stop_opt->description = _("to_stop column name");
+
+    walk_length_opt = G_define_option();
+    walk_length_opt->key = "walk_length";
+    walk_length_opt->type = TYPE_STRING;
+    walk_length_opt->required = YES;
+    walk_length_opt->answer = "length";
+    walk_length_opt->description = _("walk_length column name");
+
     /* options and flags parser */
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
@@ -297,10 +321,6 @@
 
     /* parse filter option and select appropriate lines */
     layer = atoi(field_opt->answer);
-    chcat =
-	(neta_initialise_varray
-	 (&In, layer, mask_type, where_opt->answer, cat_opt->answer,
-	  &varray) == 1);
     path_layer = atoi(path_layer_opt->answer);
 
 
@@ -314,7 +334,8 @@
     Vect_hist_command(&Out);
 
     if (neta_init_timetable_from_db
-	(&In, layer, atoi(walk_layer_opt->answer), "route_id", "stop",
+	(&In, layer, atoi(walk_layer_opt->answer), route_id_opt->answer,
+	 stop_time_opt->answer, to_stop_opt->answer, walk_length_opt->answer,
 	 &timetable, &route_ids, &stop_ids) != 0)
 	G_fatal_error(_("Could not initialize the timetables"));
 



More information about the grass-commit mailing list