[GRASS-SVN] r40188 - in grass/trunk/vector: v.buffer v.build v.category v.extract v.out.ogr v.overlay v.select v.split v.surf.idw v.surf.rst v.to.3d v.to.db v.to.points v.to.rast v.to.rast3 v.transform v.type v.univar v.what

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 2 09:08:18 EST 2010


Author: martinl
Date: 2010-01-02 09:08:18 -0500 (Sat, 02 Jan 2010)
New Revision: 40188

Modified:
   grass/trunk/vector/v.buffer/main.c
   grass/trunk/vector/v.build/main.c
   grass/trunk/vector/v.category/main.c
   grass/trunk/vector/v.extract/main.c
   grass/trunk/vector/v.out.ogr/main.c
   grass/trunk/vector/v.overlay/main.c
   grass/trunk/vector/v.select/args.c
   grass/trunk/vector/v.split/main.c
   grass/trunk/vector/v.surf.idw/main.c
   grass/trunk/vector/v.surf.idw/proto.h
   grass/trunk/vector/v.surf.idw/read_sites.c
   grass/trunk/vector/v.surf.rst/main.c
   grass/trunk/vector/v.to.3d/args.c
   grass/trunk/vector/v.to.3d/local_proto.h
   grass/trunk/vector/v.to.3d/main.c
   grass/trunk/vector/v.to.3d/trans2.c
   grass/trunk/vector/v.to.3d/trans3.c
   grass/trunk/vector/v.to.db/main.c
   grass/trunk/vector/v.to.db/parse.c
   grass/trunk/vector/v.to.points/main.c
   grass/trunk/vector/v.to.rast/local.h
   grass/trunk/vector/v.to.rast/main.c
   grass/trunk/vector/v.to.rast/vect2rast.c
   grass/trunk/vector/v.to.rast3/main.c
   grass/trunk/vector/v.transform/creat_trans.c
   grass/trunk/vector/v.transform/local_proto.h
   grass/trunk/vector/v.transform/main.c
   grass/trunk/vector/v.transform/trans_digit.c
   grass/trunk/vector/v.type/main.c
   grass/trunk/vector/v.univar/main.c
   grass/trunk/vector/v.what/main.c
   grass/trunk/vector/v.what/what.c
   grass/trunk/vector/v.what/what.h
Log:
OGR support (read)


Modified: grass/trunk/vector/v.buffer/main.c
===================================================================
--- grass/trunk/vector/v.buffer/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.buffer/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -150,16 +150,17 @@
 	_("Creates a buffer around vector features of given type.");
 
     in_opt = G_define_standard_option(G_OPT_V_INPUT);
-    out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
 
+    field_opt = G_define_standard_option(G_OPT_V_FIELD_ALL);
+    field_opt->guisection = _("Selection");
+
     type_opt = G_define_standard_option(G_OPT_V_TYPE);
     type_opt->options = "point,line,boundary,centroid,area";
     type_opt->answer = "point,line,area";
     type_opt->guisection = _("Selection");
 
-    field_opt = G_define_standard_option(G_OPT_V_FIELD_ALL);
-    field_opt->guisection = _("Selection");
-
+    out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
+    
     dista_opt = G_define_option();
     dista_opt->key = "distance";
     dista_opt->type = TYPE_DOUBLE;

Modified: grass/trunk/vector/v.build/main.c
===================================================================
--- grass/trunk/vector/v.build/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.build/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -34,7 +34,7 @@
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("topology"));
-    module->description = _("Creates topology for GRASS vector map.");
+    module->description = _("Creates topology for vector map.");
 
     map_opt = G_define_standard_option(G_OPT_V_MAP);
 

Modified: grass/trunk/vector/v.category/main.c
===================================================================
--- grass/trunk/vector/v.category/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.category/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -75,6 +75,17 @@
 
     in_opt = G_define_standard_option(G_OPT_V_INPUT);
 
+    field_opt = G_define_standard_option(G_OPT_V_FIELD);
+    field_opt->multiple = YES;
+    field_opt->guisection = _("Selection");
+
+    type_opt = G_define_standard_option(G_OPT_V3_TYPE);
+    type_opt->guisection = _("Selection");
+
+    id_opt = G_define_standard_option(G_OPT_V_IDS);
+    id_opt->label = _("Feature ids (by default all features are processed)");
+    id_opt->guisection = _("Selection");
+
     out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
     out_opt->required = NO;
 
@@ -91,18 +102,7 @@
 				 "sum;add the value specified by cat option to the current category value;"
 				 "report;print report (statistics), in shell style: layer type count min max;"
 				 "print;print category values, more cats in the same layer are separated by '/'");
-
-    type_opt = G_define_standard_option(G_OPT_V3_TYPE);
-    type_opt->guisection = _("Selection");
-
-    field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    field_opt->multiple = YES;
-    field_opt->guisection = _("Selection");
-
-    id_opt = G_define_standard_option(G_OPT_V_IDS);
-    id_opt->label = _("Feature ids (by default all features are processed)");
-    id_opt->guisection = _("Selection");
-
+    
     cat_opt = G_define_standard_option(G_OPT_V_CAT);
     cat_opt->answer = "1";
 

Modified: grass/trunk/vector/v.extract/main.c
===================================================================
--- grass/trunk/vector/v.extract/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.extract/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -109,24 +109,24 @@
 
     inopt = G_define_standard_option(G_OPT_V_INPUT);
 
-    outopt = G_define_standard_option(G_OPT_V_OUTPUT);
-
+    fieldopt = G_define_standard_option(G_OPT_V_FIELD_ALL);
+    fieldopt->guisection = _("Selection");
+    
     typopt = G_define_standard_option(G_OPT_V_TYPE);
     typopt->answer = "point,line,boundary,centroid,area,face";
     typopt->options = "point,line,boundary,centroid,area,face";
     typopt->label = _("Types to be extracted");
     typopt->guisection = _("Selection");
 
-    fieldopt = G_define_standard_option(G_OPT_V_FIELD_ALL);
-    fieldopt->guisection = _("Selection");
-    
     listopt = G_define_standard_option(G_OPT_V_CATS);
     listopt->key = "list";
     listopt->guisection = _("Selection");
 
     whereopt = G_define_standard_option(G_OPT_DB_WHERE);
     whereopt->guisection = _("Selection");
-
+    
+    outopt = G_define_standard_option(G_OPT_V_OUTPUT);
+    
     fileopt = G_define_standard_option(G_OPT_F_INPUT);
     fileopt->key = "file";
     fileopt->required = NO;

Modified: grass/trunk/vector/v.out.ogr/main.c
===================================================================
--- grass/trunk/vector/v.out.ogr/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.out.ogr/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -302,22 +302,34 @@
     
     /* check if the map is 3d */
     if (Vect_is_3d(&In)) {
-	/* specific check for shp */
+	/* specific check for ESRI ShapeFile */
 	if (strcmp(options.format->answer, "ESRI_Shapefile") == 0) {
 	    const char *shpt;
 
 	    shpt = CSLFetchNameValue(papszLCO, "SHPT");
 	    if (!shpt || shpt[strlen(shpt) - 1] != 'Z') {
 		G_warning(_("Vector map <%s> is 3D. "
-			    "Use format specific layer creation options (parameter 'lco') "
+			    "Use format specific layer creation options SHPT (parameter 'lco') "
 			    "to export in 3D rather than 2D (default)"),
 			  options.input->answer);
 	    }
 	}
+	/* specific check for PostgreSQL */
+	else if (strcmp(options.format->answer, "PostgreSQL") == 0) {
+	    const char *dim;
+
+	    dim = CSLFetchNameValue(papszLCO, "DIM");
+	    if (!dim || strcmp(dim, "3") != 0) {
+		G_warning(_("Vector map <%s> is 3D. "
+			    "Use format specific layer creation options DIM (parameter 'lco') "
+			    "to export in 3D rather than 2D (default)."),
+			  options.input->answer);
+	    }
+	}
 	else {
 	    G_warning(_("Vector map <%s> is 3D. "
 			"Use format specific layer creation options (parameter 'lco') "
-			"to export in 3D rather than 2D (default)"),
+			"to export in 3D rather than 2D (default)."),
 		      options.input->answer);
 	}
     }
@@ -578,7 +590,6 @@
 			       Points->z[0]);
 	    }
 	    else {		/* GV_LINE or GV_BOUNDARY */
-
 		Ogr_geometry = OGR_G_CreateGeometry(wkbLineString);
 		for (j = 0; j < Points->n_points; j++) {
 		    OGR_G_AddPoint(Ogr_geometry, Points->x[j], Points->y[j],

Modified: grass/trunk/vector/v.overlay/main.c
===================================================================
--- grass/trunk/vector/v.overlay/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.overlay/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -63,30 +63,30 @@
     in_opt[0]->label = _("Name of input vector map (A)");
     in_opt[0]->key = "ainput";
 
+    field_opt[0] = G_define_standard_option(G_OPT_V_FIELD);
+    field_opt[0]->label = _("Layer number or name (vector map A)");
+    field_opt[0]->key = "alayer";
+
     type_opt[0] = G_define_standard_option(G_OPT_V_TYPE);
     type_opt[0]->label = _("Feature type (vector map A)");
     type_opt[0]->key = "atype";
     type_opt[0]->options = "line,area";
     type_opt[0]->answer = "area";
 
-    field_opt[0] = G_define_standard_option(G_OPT_V_FIELD);
-    field_opt[0]->label = _("Layer number or name (vector map A)");
-    field_opt[0]->key = "alayer";
-
     in_opt[1] = G_define_standard_option(G_OPT_V_INPUT);
     in_opt[1]->label = _("Name of input vector map (B)");
     in_opt[1]->key = "binput";
 
+    field_opt[1] = G_define_standard_option(G_OPT_V_FIELD);
+    field_opt[1]->label = _("Layer number or name (vector map B)");
+    field_opt[1]->key = "blayer";
+
     type_opt[1] = G_define_standard_option(G_OPT_V_TYPE);
     type_opt[1]->label = _("Feature type (vector map B)");
     type_opt[1]->key = "btype";
     type_opt[1]->options = "area";
     type_opt[1]->answer = "area";
 
-    field_opt[1] = G_define_standard_option(G_OPT_V_FIELD);
-    field_opt[1]->label = _("Layer number or name (vector map B)");
-    field_opt[1]->key = "blayer";
-
     operator_opt = G_define_option();
     operator_opt->key = "operator";
     operator_opt->type = TYPE_STRING;

Modified: grass/trunk/vector/v.select/args.c
===================================================================
--- grass/trunk/vector/v.select/args.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.select/args.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -10,30 +10,30 @@
     parm->input[0]->description = _("Name of input vector map (A)");
     parm->input[0]->key = "ainput";
 
+    parm->field[0] = G_define_standard_option(G_OPT_V_FIELD);
+    parm->field[0]->label = _("Layer number (vector map A)");
+    parm->field[0]->key = "alayer";
+    parm->field[0]->guisection = _("Selection");
+
     parm->type[0] = G_define_standard_option(G_OPT_V_TYPE);
     parm->type[0]->label = _("Feature type (vector map A)");
     parm->type[0]->key = "atype";
     parm->type[0]->guisection = _("Selection");
 
-    parm->field[0] = G_define_standard_option(G_OPT_V_FIELD);
-    parm->field[0]->label = _("Layer number (vector map A)");
-    parm->field[0]->key = "alayer";
-    parm->field[0]->guisection = _("Selection");
-
     parm->input[1] = G_define_standard_option(G_OPT_V_INPUT);
     parm->input[1]->description = _("Name of input vector map (B)");
     parm->input[1]->key = "binput";
 
+    parm->field[1] = G_define_standard_option(G_OPT_V_FIELD);
+    parm->field[1]->label = _("Layer number (vector map B)");
+    parm->field[1]->key = "blayer";
+    parm->field[1]->guisection = _("Selection");
+    
     parm->type[1] = G_define_standard_option(G_OPT_V_TYPE);
     parm->type[1]->label = _("Feature type (vector map B)");
     parm->type[1]->key = "btype";
     parm->type[1]->guisection = _("Selection");
     
-    parm->field[1] = G_define_standard_option(G_OPT_V_FIELD);
-    parm->field[1]->label = _("Layer number (vector map B)");
-    parm->field[1]->key = "blayer";
-    parm->field[1]->guisection = _("Selection");
-    
     parm->output = G_define_standard_option(G_OPT_V_OUTPUT);
 
     parm->operator = G_define_option();

Modified: grass/trunk/vector/v.split/main.c
===================================================================
--- grass/trunk/vector/v.split/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.split/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -4,19 +4,21 @@
  * MODULE:       v.split
  * 
  * AUTHOR(S):    Radim Blazek
- *               
+ *               OGR support by Martin Landa <landa.martin gmail.com>
+ *
  * PURPOSE:      Split lines to segments
  *               
- * COPYRIGHT:    (C) 2001 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2001-2009 by the GRASS Development Team
  *
- *               This program is free software under the 
- *               GNU General Public License (>=v2). 
- *               Read the file COPYING that comes with GRASS
- *               for details.
+ *               This program is free software under the GNU General
+ *               Public License (>=v2).  Read the file COPYING that
+ *               comes with GRASS for details.
  *
  **************************************************************/
+
 #include <stdlib.h>
 #include <math.h>
+
 #include <grass/gis.h>
 #include <grass/vector.h>
 #include <grass/glocale.h>
@@ -24,15 +26,13 @@
 int main(int argc, char *argv[])
 {
     struct GModule *module;
-    struct Option *in_opt, *out_opt, *length_opt, *vertices_opt;
-
-    /* struct Option *layer_opt; */
+    struct Option *in_opt, *layer_opt, *out_opt, *length_opt, *vertices_opt;
+    
     struct Map_info In, Out;
     struct line_pnts *Points, *Points2;
     struct line_cats *Cats;
 
-    /* int    layer; */
-    int line, nlines;
+    int line, nlines, layer;
     double length;
     int vertices;
 
@@ -41,34 +41,34 @@
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("geometry"));
-    module->description = "Split lines to shorter segments.";
+    module->description = _("Splits vector lines to shorter segments.");
+    
+    in_opt = G_define_standard_option(G_OPT_V_INPUT);
 
-    in_opt = G_define_standard_option(G_OPT_V_INPUT);
+    layer_opt = G_define_standard_option(G_OPT_V_FIELD_ALL);
+
     out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
-    /* layer_opt = G_define_standard_option(G_OPT_V_FIELD); */
-
+    
     length_opt = G_define_option();
     length_opt->key = "length";
     length_opt->type = TYPE_DOUBLE;
     length_opt->required = NO;
     length_opt->multiple = NO;
-    length_opt->description = "Maximum segment length.";
-
+    length_opt->description = _("Maximum segment length");
+    
     vertices_opt = G_define_option();
     vertices_opt->key = "vertices";
     vertices_opt->type = TYPE_INTEGER;
     vertices_opt->required = NO;
     vertices_opt->multiple = NO;
-    vertices_opt->description = "Maximum number of vertices in segment.";
-
+    vertices_opt->description = _("Maximum number of vertices in segment");
+    
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
-
-    /* layer = atoi ( layer_opt->answer ); */
-
+    
     if ((length_opt->answer && vertices_opt->answer) ||
 	!(length_opt->answer || vertices_opt->answer))
-	G_fatal_error("Use either length or vertices");
+	G_fatal_error(_("Use either length or vertices"));
 
     if (length_opt->answer)
 	length = atof(length_opt->answer);
@@ -76,16 +76,19 @@
     if (vertices_opt->answer) {
 	vertices = atoi(vertices_opt->answer);
 	if (vertices < 2)
-	    G_fatal_error("Number of vertices must be at least 2");
+	    G_fatal_error(_("Number of vertices must be at least 2"));
     }
-
+    
     Vect_set_open_level(2);
-    Vect_open_old(&In, in_opt->answer, "");
-    Vect_open_new(&Out, out_opt->answer, 0);
+    Vect_open_old2(&In, in_opt->answer, "", layer_opt->answer);
+    layer = Vect_get_field_number(&In, layer_opt->answer);
+    
+    Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In));
+    
     Vect_copy_head_data(&In, &Out);
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);
-
+    
     Points = Vect_new_line_struct();
     Points2 = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();
@@ -99,6 +102,9 @@
 
 	ltype = Vect_read_line(&In, Points, Cats, line);
 
+	if (layer != -1 && !Vect_cat_get(Cats, layer, NULL))
+	  continue;
+
 	if (ltype & GV_LINES) {
 	    if (length_opt->answer) {
 		double l, from, to, step;
@@ -128,9 +134,8 @@
 
 			ret = Vect_line_segment(Points, from, to, Points2);
 			if (ret == 0) {
-			    G_warning
-				("Cannot make line segment: %f - %f (line length = %f)",
-				 from, to, l);
+			    G_warning(_("Unable to make line segment: %f - %f (line length = %f)"),
+				      from, to, l);
 			    continue;
 			}
 
@@ -186,6 +191,6 @@
     Vect_close(&In);
     Vect_build(&Out);
     Vect_close(&Out);
-
-    exit(0);
+    
+    exit(EXIT_SUCCESS);
 }

Modified: grass/trunk/vector/v.surf.idw/main.c
===================================================================
--- grass/trunk/vector/v.surf.idw/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.surf.idw/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -7,12 +7,14 @@
  *               points outside current region) by Paul Kelly
  *               further: Radim Blazek <radim.blazek gmail.com>,  Huidae Cho <grass4u gmail.com>,
  *               Glynn Clements <glynn gclements.plus.com>, Markus Neteler <neteler itc.it>
- * PURPOSE:      
- * COPYRIGHT:    (C) 2003-2006 by the GRASS Development Team
+ *               OGR support by Martin Landa <landa.martin gmail.com>
+ * PURPOSE:      Surface interpolation from vector point data by Inverse
+ *               Distance Squared Weighting
+ * COPYRIGHT:    (C) 2003-2009 by the GRASS Development Team
  *
- *               This program is free software under the GNU General Public
- *               License (>=v2). Read the file COPYING that comes with GRASS
- *               for details.
+ *               This program is free software under the GNU General
+ *               Public License (>=v2). Read the file COPYING that
+ *               comes with GRASS for details.
  *
  *****************************************************************************/
 #include <stdlib.h>
@@ -20,6 +22,7 @@
 #include <grass/gis.h>
 #include <grass/raster.h>
 #include <grass/glocale.h>
+#include "proto.h"
 
 int search_points = 12;
 
@@ -43,12 +46,7 @@
 struct Point *noidxpoints = NULL;
 struct list_Point *list;
 static struct Cell_head window;
-void calculate_distances(int, int, double, double, int *);
-void calculate_distances_noindex(double, double);
 
-/* read_sites.c */
-void read_sites(char *, int, char *, int);
-
 int main(int argc, char *argv[])
 {
     int fd, maskfd;
@@ -63,7 +61,7 @@
     double north, east;
     double dist;
     double sum1, sum2, interp_value;
-    int n, field;
+    int n;
     struct
     {
 	struct Option *input, *npoints, *output, *dfield, *col;
@@ -85,6 +83,7 @@
 
     module = G_define_module();
     G_add_keyword(_("vector"));
+    G_add_keyword(_("surface"));
     G_add_keyword(_("interpolation"));
     module->description =
 	_("Surface interpolation from vector point data by Inverse "
@@ -92,6 +91,12 @@
 
     parm.input = G_define_standard_option(G_OPT_V_INPUT);
 
+    parm.dfield = G_define_standard_option(G_OPT_V_FIELD);
+    
+    parm.col = G_define_standard_option(G_OPT_DB_COLUMN);
+    parm.col->required = NO;
+    parm.col->description = _("Name of attribute column with values to interpolate");
+
     parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
 
     parm.npoints = G_define_option();
@@ -102,44 +107,32 @@
     parm.npoints->description = _("Number of interpolation points");
     parm.npoints->answer = "12";
 
-    parm.dfield = G_define_standard_option(G_OPT_V_FIELD);
-    parm.dfield->answer = "1";
-
-    parm.col = G_define_option();
-    parm.col->key = "column";
-    parm.col->type = TYPE_STRING;
-    parm.col->required = NO;
-    parm.col->description = _("Attribute table column with values to interpolate");
-
     flag.noindex = G_define_flag();
     flag.noindex->key = 'n';
     flag.noindex->label = _("Don't index points by raster cell");
     flag.noindex->description = _("Slower but uses"
-			     " less memory and includes points from outside region"
-			     " in the interpolation");
+				  " less memory and includes points from outside region"
+				  " in the interpolation");
 
     flag.withz = G_define_flag();
     flag.withz->key = 'z';
-    flag.withz->description = _("Use z coordinates for approximation");
+    flag.withz->description = _("Use z coordinates for approximation (3D vector maps only)");
     
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     if (sscanf(parm.npoints->answer, "%d", &search_points) != 1 ||
 	search_points < 1)
-	G_fatal_error(_("%s=%s - illegal number of interpolation points"),
+	G_fatal_error(_("Illegal number of interpolation points"),
 		      parm.npoints->key, parm.npoints->answer);
-
-    sscanf(parm.dfield->answer, "%d", &field);
-
+    
     if (!flag.withz->answer && !parm.col->answer)
 	G_fatal_error(_("No attribute column specified"));
 
     list =
-	(struct list_Point *)G_calloc((size_t) search_points,
-				      sizeof(struct list_Point));
-
-
+	(struct list_Point *) G_calloc((size_t) search_points,
+				       sizeof(struct list_Point));
+    
     /* get the window, dimension arrays */
     G_get_window(&window);
 
@@ -164,11 +157,11 @@
     }
 
     /* read the elevation points from the input sites file */
-    read_sites(parm.input->answer, flag.withz->answer ? 0 : field,
-	       parm.col->answer, flag.noindex->answer);
-
+    read_sites(parm.input->answer, parm.dfield->answer,
+	       parm.col->answer, flag.noindex->answer, flag.withz->answer);
+    
     if (npoints == 0)
-	G_fatal_error(_("No data points found"));
+	G_fatal_error(_("No points found"));
     nsearch = npoints < search_points ? npoints : search_points;
 
     if (!flag.noindex->answer) {
@@ -258,7 +251,7 @@
 
     north = window.north + window.ns_res / 2.0;
     for (row = 0; row < window.rows; row++) {
-	G_percent(row, window.rows - 1, 1);
+	G_percent(row, window.rows, 1);
 
 	if (mask) {
 	    if (Rast_get_c_row(maskfd, mask, row) < 0)
@@ -397,12 +390,15 @@
 	}
 	Rast_put_d_row(fd, dcell);
     }
+    G_percent(1, 1, 1);
+
     Rast_close(fd);
+
     /* writing history file */
     Rast_short_history(parm.output->answer, "raster", &history);
     Rast_command_history(&history);
     Rast_write_history(parm.output->answer, &history);
-
+    
     G_done_msg(" ");
 
     exit(EXIT_SUCCESS);

Modified: grass/trunk/vector/v.surf.idw/proto.h
===================================================================
--- grass/trunk/vector/v.surf.idw/proto.h	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.surf.idw/proto.h	2010-01-02 14:08:18 UTC (rev 40188)
@@ -1 +1,6 @@
+/* read_sites.c */
+void read_sites(const char *, const char *, const char *, int, int);
+
 void newpoint(double, double, double, int);
+void calculate_distances(int, int, double, double, int *);
+void calculate_distances_noindex(double, double);

Modified: grass/trunk/vector/v.surf.idw/read_sites.c
===================================================================
--- grass/trunk/vector/v.surf.idw/read_sites.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.surf.idw/read_sites.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -13,10 +13,10 @@
  * mccauley
  */
 
-void read_sites(char *name, int field, char *col, int noindex)
+void read_sites(const char *name, const char *field_name, const char *col, int noindex, int with_z)
 {
     extern long npoints;
-    int nrec, ctype = 0, type;
+    int nrec, ctype = 0, type, field;
     struct Map_info Map;
     struct field_info *Fi;
     dbDriver *Driver;
@@ -24,15 +24,16 @@
     struct line_pnts *Points;
     struct line_cats *Cats;
 
-    Vect_open_old(&Map, name, "");
-
-    if (field > 0) {
+    Vect_open_old2(&Map, name, "", field_name);
+    field = Vect_get_field_number(&Map, field_name);
+    
+    if (!with_z) {
 	db_CatValArray_init(&cvarr);
 
 	Fi = Vect_get_field(&Map, field);
 	if (Fi == NULL)
-	    G_fatal_error(_("Database connection not defined for layer %d"),
-			  field);
+	    G_fatal_error(_("Database connection not defined for layer %s"),
+			  field_name);
 
 	Driver = db_start_driver_open_database(Fi->driver, Fi->database);
 	if (Driver == NULL)
@@ -51,7 +52,7 @@
 	if (nrec < 0)
 	    G_fatal_error(_("Unable to select data from table"));
 
-	G_message(_("%d records selected from table"), nrec);
+	G_verbose_message(_("%d records selected from table"), nrec);
 
 	db_close_database_shutdown_driver(Driver);
     }
@@ -66,7 +67,7 @@
 	if (!(type & GV_POINTS))
 	    continue;
 
-	if (field > 0) {
+	if (!with_z) {
 	    int cat, ival, ret;
 
 	    /* TODO: what to do with multiple cats */
@@ -93,7 +94,7 @@
 	newpoint(dval, Points->x[0], Points->y[0], noindex);
     }
 
-    if (field > 0)
+    if (!with_z)
 	db_CatValArray_free(&cvarr);
 
     Vect_set_release_support(&Map);

Modified: grass/trunk/vector/v.surf.rst/main.c
===================================================================
--- grass/trunk/vector/v.surf.rst/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.surf.rst/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -1,31 +1,25 @@
 
-/*-
- * Written by H. Mitasova, I. Kosinovsky, D. Gerdes Fall 1993
- * University of Illinois
- * US Army Construction Engineering Research Lab
- * Copyright 1993, H. Mitasova (University of Illinois),
- * I. Kosinovsky, (USA-CERL), and D.Gerdes (USA-CERL)
+/****************************************************************************
  *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
+ * MODULE:       v.surf.rst
+ * AUTHOR(S):    H. Mitasova, I. Kosinovsky, D. Gerdes Fall 1993
+ *               University of Illinois
+ *               I. Kosinovsky, (USA-CERL), and D.Gerdes (USA-CERL)
+ *               Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
+ *               modified by McCauley in August 1995
+ *               modified by Mitasova in August 1995
+ *               modified by Mitasova in November 1999 (dmax, timestamp update)
+ *               dnorm independent tension - -t flag
+ *               cross-validation -v flag by Jaro Hofierka 2004
  *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ * PURPOSE:      Surface interpolation from vector point data by splines
+ * COPYRIGHT:    (C) 2003-2009 by the GRASS Development Team
  *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ *               This program is free software under the GNU General
+ *               Public License (>=v2). Read the file COPYING that
+ *               comes with GRASS for details.
  *
- * modified by McCauley in August 1995
- * modified by Mitasova in August 1995
- * modified by Mitasova in November 1999 (dmax, timestamp update)
- * dnorm independent tension - -t flag
- * cross-validation -v flag by Jaro Hofierka 2004
- */
+ *****************************************************************************/
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -42,10 +36,10 @@
 #include <grass/interpf.h>
 
 #include <grass/qtree.h>
-#include "surf.h"
 #include <grass/dataquad.h>
 #include <grass/gmath.h>
 
+#include "surf.h"
 
 #define SCIK1 1			/*100000 */
 #define SCIK2 1			/*100000 */
@@ -116,7 +110,7 @@
 
 int main(int argc, char *argv[])
 {
-    int per, npmin;
+    int npmin;
     int ii;
     double x_orig, y_orig, dnorm, deltx, delty, xm, ym;
     char dmaxchar[200];
@@ -146,6 +140,8 @@
 
     module = G_define_module();
     G_add_keyword(_("vector"));
+    G_add_keyword(_("surface"));
+    G_add_keyword(_("interpolation"));
     module->description =
 	_("Spatial approximation and topographic analysis from given "
 	  "point or isoline data in vector format to floating point "
@@ -170,7 +166,7 @@
 
     flag.withz = G_define_flag();
     flag.withz->key = 'z';
-    flag.withz->description = _("Use z coordinates for approximation");
+    flag.withz->description = _("Use z coordinates for approximation (3D vector maps only)");
     flag.withz->guisection = _("Parameters");
     
     parm.input = G_define_standard_option(G_OPT_V_INPUT);
@@ -179,88 +175,85 @@
     parm.field->answer = "1";
     parm.field->guisection = _("Selection");
 
+    parm.zcol = G_define_standard_option(G_OPT_DB_COLUMN);
+    parm.zcol->key = "zcolumn";
+    parm.zcol->required = NO;
+    parm.zcol->description =
+	_("Name of the attribute column with values to be used for approximation");
+    parm.zcol->guisection = _("Parameters");
+
     parm.wheresql = G_define_standard_option(G_OPT_DB_WHERE);
     parm.wheresql->guisection = _("Selection");
 
     parm.elev = G_define_standard_option(G_OPT_R_OUTPUT);
     parm.elev->key = "elev";
     parm.elev->required = NO;
-    parm.elev->description = _("Output surface raster map (elevation)");
+    parm.elev->description = _("Name for output surface raster map (elevation)");
     parm.elev->guisection = _("Outputs");
 
     parm.slope = G_define_standard_option(G_OPT_R_OUTPUT);
     parm.slope->key = "slope";
     parm.slope->required = NO;
-    parm.slope->description = _("Output slope raster map");
+    parm.slope->description = _("Name for output slope raster map");
     parm.slope->guisection = _("Outputs");
 
     parm.aspect = G_define_standard_option(G_OPT_R_OUTPUT);
     parm.aspect->key = "aspect";
     parm.aspect->required = NO;
-    parm.aspect->description = _("Output aspect raster map");
+    parm.aspect->description = _("Name for output aspect raster map");
     parm.aspect->guisection = _("Outputs");
 
     parm.pcurv = G_define_standard_option(G_OPT_R_OUTPUT);
     parm.pcurv->key = "pcurv";
     parm.pcurv->required = NO;
-    parm.pcurv->description = _("Output profile curvature raster map");
+    parm.pcurv->description = _("Name for output profile curvature raster map");
     parm.pcurv->guisection = _("Outputs");
 
     parm.tcurv = G_define_standard_option(G_OPT_R_OUTPUT);
     parm.tcurv->key = "tcurv";
     parm.tcurv->required = NO;
-    parm.tcurv->description = _("Output tangential curvature raster map");
+    parm.tcurv->description = _("Name for output tangential curvature raster map");
     parm.tcurv->guisection = _("Outputs");
 
     parm.mcurv = G_define_standard_option(G_OPT_R_OUTPUT);
     parm.mcurv->key = "mcurv";
     parm.mcurv->required = NO;
-    parm.mcurv->description = _("Output mean curvature raster map");
+    parm.mcurv->description = _("Name for output mean curvature raster map");
     parm.mcurv->guisection = _("Outputs");
 
-    parm.devi = G_define_option();
+    parm.devi = G_define_standard_option(G_OPT_V_OUTPUT);
     parm.devi->key = "devi";
-    parm.devi->type = TYPE_STRING;
     parm.devi->required = NO;
-    parm.devi->gisprompt = "new,vector,vector";
-    parm.devi->description = _("Output deviations vector point file");
+    parm.devi->description = _("Name for output deviations vector point map");
     parm.devi->guisection = _("Outputs");
 
     parm.cvdev = G_define_standard_option(G_OPT_V_OUTPUT);
     parm.cvdev->key = "cvdev";
     parm.cvdev->required = NO;
     parm.cvdev->description =
-	_("Output cross-validation errors vector point file");
+	_("Name for output cross-validation errors vector point map");
     parm.cvdev->guisection = _("Outputs");
 
     parm.treefile = G_define_standard_option(G_OPT_V_OUTPUT);
     parm.treefile->key = "treefile";
     parm.treefile->required = NO;
     parm.treefile->description =
-	_("Output vector map showing quadtree segmentation");
+	_("Name for output vector map showing quadtree segmentation");
     parm.treefile->guisection = _("Outputs");
 
     parm.overfile = G_define_standard_option(G_OPT_V_OUTPUT);
     parm.overfile->key = "overfile";
     parm.overfile->required = NO;
     parm.overfile->description =
-	_("Output vector map showing overlapping windows");
+	_("Name for output vector map showing overlapping windows");
     parm.overfile->guisection = _("Outputs");
 
     parm.maskmap = G_define_standard_option(G_OPT_R_INPUT);
     parm.maskmap->key = "maskmap";
     parm.maskmap->required = NO;
-    parm.maskmap->description = _("Name of the raster map used as mask");
+    parm.maskmap->description = _("Name of raster map used as mask");
     parm.maskmap->guisection = _("Parameters");
 
-    parm.zcol = G_define_option();
-    parm.zcol->key = "zcolumn";
-    parm.zcol->type = TYPE_STRING;
-    parm.zcol->required = NO;
-    parm.zcol->description =
-	_("Name of the attribute column with values to be used for approximation");
-    parm.zcol->guisection = _("Parameters");
-
     parm.fi = G_define_option();
     parm.fi->key = "tension";
     parm.fi->type = TYPE_DOUBLE;
@@ -363,14 +356,20 @@
     sprintf(dmaxchar, "%f", dmin * 5);
     sprintf(dminchar, "%f", dmin);
 
-    if (!parm.dmin->answer)
-	parm.dmin->answer = dminchar;
-    if (!parm.dmax->answer)
-	parm.dmax->answer = dmaxchar;
-
-    per = 1;
+    if (!parm.dmin->answer) {
+	parm.dmin->answer = G_store(dminchar);
+	parm.dmin->answers = (char **) G_malloc(2 * sizeof(char *));
+	parm.dmin->answers[0] = G_store(dminchar);
+	parm.dmin->answers[1] = NULL;
+    }
+    if (!parm.dmax->answer) {
+	parm.dmax->answer = G_store(dmaxchar);
+	parm.dmax->answers = (char **) G_malloc(2 * sizeof(char *));
+	parm.dmax->answers[0] = G_store(dmaxchar);
+	parm.dmax->answers[1] = NULL;
+    }
+    
     input = parm.input->answer;
-    field = atoi(parm.field->answer);
     zcol = parm.zcol->answer;
     scol = parm.scol->answer;
     wheresql = parm.wheresql->answer;
@@ -526,7 +525,11 @@
     if ((info = MT_tree_info_new(root, functions, dmin, KMAX)) == NULL)
 	G_fatal_error(_("Cannot create tree info"));
 
-    open_check = Vect_open_old(&Map, input, "");
+    open_check = Vect_open_old2(&Map, input, "", parm.field->answer);
+    field = Vect_get_field_number(&Map, parm.field->answer);
+    if (!flag.withz->answer && field < 1)
+	G_fatal_error(_("Layer <%s> not found"), parm.field->answer);
+    
     if (open_check < 1)
 	G_fatal_error(_("Unable to open vector map <%s>"), input);
     /*    if (open_check < 2)
@@ -580,9 +583,7 @@
     }
 
     ertot = 0.;
-    if (per)
-	G_message(_("Percent complete: "));
-
+    
     create_temp_files();
 
     IL_init_params_2d(&params, NULL, 1, 1, zmult, KMIN, KMAX, maskmap, n_rows,
@@ -598,7 +599,7 @@
 		    IL_crstg, IL_write_temp_2d);
 
     totsegm =
-	IL_vector_input_data_2d(&params, &Map, flag.withz ? 0 : field,
+	IL_vector_input_data_2d(&params, &Map, flag.withz->answer ? 0 : field,
 				zcol, scol,
 				info, &xmin, &xmax,
 				&ymin, &ymax, &zmin, &zmax, &NPOINT, &dmax);
@@ -643,8 +644,8 @@
     if (mcurv != NULL)
 	ddisk += disk;
     ddisk += sddisk;
-    G_message(_("Processing all selected output files\n"
-		"will require %d bytes of disk space for temp files"), ddisk);
+    G_verbose_message(_("Processing all selected output files "
+			"will require %d bytes of disk space for temp files"), ddisk);
 
     deltx = xmax - xmin;
     delty = ymax - ymin;
@@ -652,18 +653,18 @@
 
     if (dtens) {
 	params.fi = params.fi * dnorm / 1000.;
-	G_message("dnorm = %f, rescaled tension = %f", dnorm, params.fi);
+	G_debug(1, "dnorm = %f, rescaled tension = %f", dnorm, params.fi);
     }
-
+    
     bitmask = IL_create_bitmask(&params);
+    
     if (totsegm <= 0) {
 	clean();
 	G_fatal_error(_("Input failed"));
     }
 
     ertot = 0.;
-    if (per)
-	G_message(_("Percent complete: "));
+    G_message(_("Processing segments..."));    
     if (IL_interp_segments_2d(&params, info, info->root, bitmask,
 			      zmin, zmax, &zminac, &zmaxac, &gmin, &gmax,
 			      &c1min, &c1max, &c2min, &c2max, &ertot, totsegm,
@@ -687,7 +688,7 @@
 		      dtens, 1, NPOINT);
     if (ii < 0) {
 	clean();
-	G_fatal_error(_("Cannot write raster maps -- try to increase resolution"));
+	G_fatal_error(_("Unable to write raster maps - try to increase resolution"));
     }
 
     G_free(zero_array_cell);
@@ -707,7 +708,7 @@
     if (overfile != NULL) {
 	if (0 > Vect_open_new(&OverMap, overfile, 0)) {
 	    clean();
-	    G_fatal_error(_("Unable to open vector map <%s>"), overfile);
+	    G_fatal_error(_("Unable to create vector map <%s>"), overfile);
 	}
 	Vect_hist_command(&OverMap);
 
@@ -742,7 +743,7 @@
 	Vect_close(&Map2);
     }
 
-    G_done_msg("\n");
+    G_done_msg(" ");
     exit(EXIT_SUCCESS);
 }
 

Modified: grass/trunk/vector/v.to.3d/args.c
===================================================================
--- grass/trunk/vector/v.to.3d/args.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.3d/args.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -16,12 +16,22 @@
 
     opt->input = G_define_standard_option(G_OPT_V_INPUT);
 
-    opt->output = G_define_standard_option(G_OPT_V_OUTPUT);
+    opt->field = G_define_standard_option(G_OPT_V_FIELD_ALL);
+    opt->field->guisection = _("Selection");
 
     opt->type = G_define_standard_option(G_OPT_V_TYPE);
     opt->type->options = "point,line,boundary,centroid";
     opt->type->answer = "point,line,boundary,centroid";
+    opt->type->guisection = _("Selection");
 
+    opt->output = G_define_standard_option(G_OPT_V_OUTPUT);
+
+    opt->column = G_define_standard_option(G_OPT_DB_COLUMN);
+    opt->column->label = _("Name of attribute column used for height");
+    opt->column->description =
+	_("Can be used for reverse transformation, to store height of points");
+    opt->column->guisection = _("Height");
+
     opt->height = G_define_option();
     opt->height->key = "height";
     opt->height->type = TYPE_DOUBLE;
@@ -29,16 +39,6 @@
     opt->height->multiple = NO;
     opt->height->description = _("Fixed height for 3D vector features");
     opt->height->guisection = _("Height");
-
-    opt->field = G_define_standard_option(G_OPT_V_FIELD);
-    opt->field->guisection = _("Height");
-
-    opt->column = G_define_standard_option(G_OPT_DB_COLUMN);
-    opt->column->label = _("Name of attribute column used for height");
-    opt->column->description =
-	_("Can be used for reverse transformation, to store height of points");
-
-    opt->column->guisection = _("Height");
-
+    
     return;
 }

Modified: grass/trunk/vector/v.to.3d/local_proto.h
===================================================================
--- grass/trunk/vector/v.to.3d/local_proto.h	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.3d/local_proto.h	2010-01-02 14:08:18 UTC (rev 40188)
@@ -15,8 +15,8 @@
 
 /* trans2.c */
 int trans2d(struct Map_info *, struct Map_info *, int,
-	    double, int, const char *);
+	    double, const char *, const char *);
 
 /* trans3.c */
 int trans3d(struct Map_info *, struct Map_info *, int,
-	    int, const char *);
+	    const char *, const char *);

Modified: grass/trunk/vector/v.to.3d/main.c
===================================================================
--- grass/trunk/vector/v.to.3d/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.3d/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -7,7 +7,7 @@
  *               
  * PURPOSE:      Performs transformation of 2D vector features to 3D
  *
- * COPYRIGHT:    (C) 2008 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2008-2010 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -28,14 +28,14 @@
     struct opts opt;
     struct Map_info In, Out;
     struct bound_box box;
-    int field, type;
+    int type;
     int ret;
     
     G_gisinit(argv[0]);
 
     module = G_define_module();
     G_add_keyword(_("vector"));
-    G_add_keyword(_("transformation"));
+    G_add_keyword(_("geometry"));
     G_add_keyword(_("3D"));
     module->description =
 	_("Performs transformation of 2D vector features to 3D.");
@@ -44,8 +44,7 @@
 
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
-
-    field = atoi(opt.field->answer);
+    
     type = Vect_option_to_types(opt.type);
 
     if (!opt.reverse->answer) {
@@ -67,12 +66,12 @@
 
     Vect_check_input_output_name(opt.input->answer, opt.output->answer,
 				 GV_FATAL_EXIT);
-
+    
     /* open input vector, topology not needed */
     Vect_set_open_level(1);
-    if (Vect_open_old(&In, opt.input->answer, "") < 1)
+    if (Vect_open_old2(&In, opt.input->answer, "", opt.field->answer) < 1)
 	G_fatal_error(_("Unable to open vector map <%s>"), opt.input->answer);
-
+    
     if (opt.reverse->answer && !Vect_is_3d(&In)) {
 	Vect_close(&In);
 	G_fatal_error(_("Vector map <%s> is 2D"), opt.input->answer);
@@ -106,7 +105,7 @@
     ret = 0;
     if (opt.reverse->answer) {
 	/* 3d -> 2d */
-	ret = trans3d(&In, &Out, type, field, opt.column->answer);
+	ret = trans3d(&In, &Out, type, opt.field->answer, opt.column->answer);
     }
     else {
 	/* 2d -> 3d */
@@ -115,7 +114,7 @@
 	if (opt.height->answer) {
 	    height = atof(opt.height->answer);
 	}
-	ret = trans2d(&In, &Out, type, height, field, opt.column->answer);
+	ret = trans2d(&In, &Out, type, height, opt.field->answer, opt.column->answer);
     }
 
     if (ret < 0) {

Modified: grass/trunk/vector/v.to.3d/trans2.c
===================================================================
--- grass/trunk/vector/v.to.3d/trans2.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.3d/trans2.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -19,9 +19,9 @@
    \return -1 on error
  */
 int trans2d(struct Map_info *In, struct Map_info *Out, int type,
-	    double height, int field, const char *column)
+	    double height, const char *field_name, const char *column)
 {
-    int i, ltype, line;
+    int i, ltype, line, field;
     int cat;
     int ret, ctype;
 
@@ -35,6 +35,8 @@
 
     db_CatValArray_init(&cvarr);
 
+    field = Vect_get_field_number(In, field_name);
+    
     if (column) {
 	struct field_info *Fi;
 
@@ -42,8 +44,8 @@
 
 	Fi = Vect_get_field(In, field);
 	if (!Fi) {
-	    G_warning(_("Database connection not defined for layer %d"),
-		      field);
+	    G_warning(_("Database connection not defined for layer <%s>"),
+		      field_name);
 	    return -1;
 	}
 
@@ -92,6 +94,9 @@
 	if (!(ltype & type))
 	    continue;
 
+	if (field != -1 && !Vect_cat_get(Cats, field, &cat))
+	    continue;
+	
 	if (column) {
 	    Vect_cat_get(Cats, field, &cat);
 	    if (cat < 0) {

Modified: grass/trunk/vector/v.to.3d/trans3.c
===================================================================
--- grass/trunk/vector/v.to.3d/trans3.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.3d/trans3.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -20,12 +20,12 @@
    \return -1 on error
  */
 int trans3d(struct Map_info *In, struct Map_info *Out, int type,
-	    int field, const char *zcolumn)
+	    const char *field_name, const char *zcolumn)
 {
-    int ltype;
-    int line;
+    int ltype, line;
     int ctype;
-
+    int field;
+    
     struct line_pnts *Points;
     struct line_cats *Cats;
 
@@ -40,11 +40,13 @@
 
     db_init_string(&stmt);
 
+    field = Vect_get_field_number(In, field_name);
+
     if (zcolumn) {
 	Fi = Vect_get_field(Out, field);
 	if (!Fi) {
-	    G_warning(_("Database connection not defined for layer %d"),
-		      field);
+	    G_warning(_("Database connection not defined for layer <%s>"),
+		      field_name);
 	    return -1;
 	}
 
@@ -92,7 +94,8 @@
 	if (!(ltype & type))
 	    continue;
 
-	Vect_cat_get(Cats, field, &cat);
+	if (field != -1 && !Vect_cat_get(Cats, field, &cat))
+	    continue;
 
 	/* get first cat */
 	if (cat == -1) {

Modified: grass/trunk/vector/v.to.db/main.c
===================================================================
--- grass/trunk/vector/v.to.db/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.db/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -7,7 +7,7 @@
  *               Glynn Clements <glynn gclements.plus.com>,
  *               Markus Neteler <neteler itc.it>
  * PURPOSE:      load values from vector to database
- * COPYRIGHT:    (C) 2000-2006 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2000-2010 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS

Modified: grass/trunk/vector/v.to.db/parse.c
===================================================================
--- grass/trunk/vector/v.to.db/parse.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.db/parse.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -30,6 +30,9 @@
 
     parms.vect = G_define_standard_option(G_OPT_V_MAP);
 
+    parms.field = G_define_standard_option(G_OPT_V_FIELD);
+    parms.field->label = _("Layer number or name (write to)");
+
     parms.type = G_define_standard_option(G_OPT_V_TYPE);
     parms.type->options = "point,line,boundary,centroid";
     parms.type->answer = "point,line,boundary,centroid";
@@ -37,13 +40,10 @@
     parms.type->description =
 	_("For coor valid point/centroid, "
 	  "for length valid line/boundary");
-
-    parms.field = G_define_standard_option(G_OPT_V_FIELD);
-    parms.field->label = _("Layer number (write to)");
-
+    
     parms.qfield = G_define_standard_option(G_OPT_V_FIELD);
     parms.qfield->key = "qlayer";
-    parms.qfield->label = _("Query layer number (read from)");
+    parms.qfield->label = _("Query layer number or name (read from)");
     parms.qfield->guisection = _("Query");
 
     parms.option = G_define_option();
@@ -81,21 +81,18 @@
     parms.units->required = NO;
     parms.units->multiple = NO;
     parms.units->options =
-	"mi,miles,f,feet,me,meters,k,kilometers,a,acres,h,hectares,r,radians,d,degrees";
+	"miles,feet,meters,kilometers,acres,hectares,radians,degrees";
     parms.units->label = _("Units");
     parms.units->description =
-	_("mi(les),f(eet),me(ters),k(ilometers),a(cres),h(ectares),r(adians),d(egrees)");
+	_("miles,feet,meters,kilometers,acres,hectares,radians,degrees");
 
     parms.col = G_define_standard_option(G_OPT_DB_COLUMNS);
 
-    parms.qcol = G_define_option();
+    parms.qcol = G_define_standard_option(G_OPT_DB_COLUMN);
     parms.qcol->key = "qcolumn";
     parms.qcol->label = _("Name of attribute column used for 'query' option");
     parms.qcol->description = _("E.g. 'cat', 'count(*)', 'sum(val)'");
-    parms.qcol->type = TYPE_STRING;
-    parms.qcol->key_desc = "name";
     parms.qcol->required = NO;
-    parms.qcol->multiple = NO;
     parms.qcol->guisection = _("Query");
 
     flags.p = G_define_flag();

Modified: grass/trunk/vector/v.to.points/main.c
===================================================================
--- grass/trunk/vector/v.to.points/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.points/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -4,15 +4,15 @@
  * MODULE:       v.to.points
  * 
  * AUTHOR(S):    Radim Blazek
+ *               OGR support by Martin Landa <landa.martin gmail.com>
  *               
  * PURPOSE:      Create points along lines 
  *               
- * COPYRIGHT:    (C) 2002 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2002-2010 by the GRASS Development Team
  *
- *               This program is free software under the 
- *               GNU General Public License (>=v2). 
- *               Read the file COPYING that comes with GRASS
- *               for details.
+ *               This program is free software under the GNU General
+ *               Public License (>=v2).  Read the file COPYING that
+ *               comes with GRASS for details.
  *
  **************************************************************/
 #include <stdlib.h>
@@ -172,22 +172,24 @@
     G_add_keyword(_("vector"));
     G_add_keyword(_("geometry"));
     module->description =
-	_("Create points along input lines in new vector with 2 layers.");
+	_("Creates points along input lines in new vector map with 2 layers.");
 
     in_opt = G_define_standard_option(G_OPT_V_INPUT);
-    in_opt->description = _("Input vector map containing lines");
+    in_opt->label = _("Name of vector map containing lines");
 
-    out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
-    out_opt->description =
-	_("Output vector map where points will be written");
+    lfield_opt = G_define_standard_option(G_OPT_V_FIELD);
+    lfield_opt->key = "llayer";
+    lfield_opt->answer = "1";
+    lfield_opt->label = "Line layer number or name";
+    lfield_opt->guisection = _("Selection");
 
     type_opt = G_define_standard_option(G_OPT_V_TYPE);
     type_opt->answer = "point,line,boundary,centroid";
+    type_opt->guisection = _("Selection");
 
-    lfield_opt = G_define_standard_option(G_OPT_V_FIELD);
-    lfield_opt->key = "llayer";
-    lfield_opt->answer = "1";
-    lfield_opt->description = "Line layer";
+    out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
+    out_opt->description =
+	_("Name for output vector map where points will be written");
 
     node_flag = G_define_flag();
     node_flag->key = 'n';
@@ -221,7 +223,6 @@
     PPoints = Vect_new_line_struct();
     db_init_string(&stmt);
 
-    field = atoi(lfield_opt->answer);
     type = Vect_option_to_types(type_opt);
     dmax = atof(dmax_opt->answer);
 
@@ -240,8 +241,9 @@
 
     /* Open input lines */
     Vect_set_open_level(2);
-    Vect_open_old(&In, in_opt->answer, "");
-
+    Vect_open_old2(&In, in_opt->answer, "", lfield_opt->answer);
+    field = Vect_get_field_number(&In, lfield_opt->answer);
+    
     /* Open output segments */
     Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In));
     Vect_copy_head_data(&In, &Out);
@@ -319,9 +321,9 @@
 	    ltype = Vect_read_line(&In, LPoints, LCats, line);
 	    if (!(ltype & type))
 		continue;
+	    if (!Vect_cat_get(LCats, field, &cat))
+		continue;
 
-	    Vect_cat_get(LCats, field, &cat);
-
 	    if (LPoints->n_points <= 1) {
 		write_point(&Out, LPoints->x[0], LPoints->y[0], LPoints->z[0],
 			    cat, 0.0, table_flag->answer);
@@ -345,7 +347,8 @@
 	    cat = -1;
 	    if (centroid > 0) {
 		Vect_read_line(&In, NULL, LCats, centroid);
-		Vect_cat_get(LCats, field, &cat);
+		if (!Vect_cat_get(LCats, field, &cat))
+		  continue;
 	    }
 
 	    Vect_get_area_points(&In, area, LPoints);
@@ -377,7 +380,7 @@
     Vect_close(&In);
     Vect_close(&Out);
 
-    G_done_msg(_("%d points written to output vector map"), point_cat - 1);
+    G_done_msg(_("%d points written to output vector map."), point_cat - 1);
 
     exit(EXIT_SUCCESS);
 }

Modified: grass/trunk/vector/v.to.rast/local.h
===================================================================
--- grass/trunk/vector/v.to.rast/local.h	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.rast/local.h	2010-01-02 14:08:18 UTC (rev 40188)
@@ -6,8 +6,6 @@
 #include <grass/vector.h>
 
 
-#undef DEBUG
-
 /* 2 * PI */
 #define M_2PI 6.283185307179586232
 
@@ -52,7 +50,7 @@
 int update_fcolors(const char *);
 
 /* vect2rast.c */
-int vect_to_rast(const char *, const char *, int, const char *, int, int,
+int vect_to_rast(const char *, const char *, const char *, const char *, int, int,
 		 double, int, const char *, const char *, int);
 
 #endif

Modified: grass/trunk/vector/v.to.rast/main.c
===================================================================
--- grass/trunk/vector/v.to.rast/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.rast/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -7,8 +7,9 @@
  *               Radim Blazek <radim.blazek gmail.com> (GRASS 6 update)
  *               Brad Douglas <rez touchofmadness.com>, Glynn Clements <glynn gclements.plus.com>,
  *               Hamish Bowman <hamish_b yahoo.com>, Markus Neteler <neteler itc.it>
- * PURPOSE:      
- * COPYRIGHT:    (C) 2003-2009 by the GRASS Development Team
+ *               OGR support by Martin Landa <landa.martin gmail.com>
+ * PURPOSE:      Converts vector map to raster map
+ * COPYRIGHT:    (C) 2003-2010 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -30,7 +31,7 @@
     struct GModule *module;
     struct Option *input, *output, *rows, *col, *field_opt, *use_opt,
 	*val_opt, *rgbcol_opt, *label_opt, *type_opt;
-    int field, nrows, use, value_type, type;
+    int nrows, use, value_type, type;
     double value;
 
     G_gisinit(argv[0]);
@@ -39,19 +40,24 @@
     G_add_keyword(_("vector"));
     G_add_keyword(_("raster"));
     G_add_keyword(_("conversion"));
-    module->description = _("Converts a binary GRASS vector map "
-			    "into a GRASS raster map .");
+    G_add_keyword(_("rasterization"));
+    module->description = _("Converts a vector map into a raster map.");
 
     input = G_define_standard_option(G_OPT_V_INPUT);
-    output = G_define_standard_option(G_OPT_R_OUTPUT);
 
+    field_opt = G_define_standard_option(G_OPT_V_FIELD);
+
+    type_opt = G_define_standard_option(G_OPT_V_TYPE);
+    type_opt->options = "point,line,area";
+    type_opt->answer = "point,line,area";
+
+    output = G_define_standard_option(G_OPT_R_OUTPUT);
     use_opt = G_define_option();
     use_opt->key = "use";
     use_opt->type = TYPE_STRING;
-    use_opt->required = NO;
+    use_opt->required = YES;
     use_opt->multiple = NO;
     use_opt->options = "attr,cat,val,z,dir";
-    use_opt->answer = "attr";
     use_opt->description = _("Source of raster values");
     use_opt->descriptions = _("attr;read values from attribute table;"
 			      "cat;use category values;"
@@ -59,14 +65,8 @@
 			      "z;use z coordinate (points or contours only);"
 			      "dir;output as flow direction (lines only)");
 
-    type_opt = G_define_standard_option(G_OPT_V_TYPE);
-    type_opt->options = "point,line,area";
-    type_opt->answer = "point,line,area";
-
-    field_opt = G_define_standard_option(G_OPT_V_FIELD);
-
-    /* for GRASS 7, IMHO this should be changed to "attrcolumn" */
     col = G_define_standard_option(G_OPT_DB_COLUMN);
+    col->key = "attrcolumn";
     col->description =
 	_("Name of column for attr parameter (data type must be numeric)");
     col->guisection = _("Attributes");
@@ -79,14 +79,6 @@
     val_opt->answer = "1";
     val_opt->description = _("Raster value");
 
-    rows = G_define_option();
-    rows->key = "rows";
-    rows->type = TYPE_INTEGER;
-    rows->required = NO;
-    rows->multiple = NO;
-    rows->answer = "4096";
-    rows->description = _("Number of rows to hold in memory");
-
     rgbcol_opt = G_define_standard_option(G_OPT_DB_COLUMN);
     rgbcol_opt->key = "rgbcolumn";
     rgbcol_opt->description =
@@ -98,12 +90,19 @@
     label_opt->description =
 	_("Name of column used as raster category labels");
     label_opt->guisection = _("Attributes");
+    
+    rows = G_define_option();
+    rows->key = "rows";
+    rows->type = TYPE_INTEGER;
+    rows->required = NO;
+    rows->multiple = NO;
+    rows->answer = "4096";
+    rows->description = _("Number of rows to hold in memory");
 
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     type = Vect_option_to_types(type_opt);
-    field = atoi(field_opt->answer);
     nrows = atoi(rows->answer);
 
     switch (use_opt->answer[0]) {
@@ -138,7 +137,7 @@
     value = atof(val_opt->answer);
     value_type = (strchr(val_opt->answer, '.')) ? USE_DCELL : USE_CELL;
 
-    if (vect_to_rast(input->answer, output->answer, field,
+    if (vect_to_rast(input->answer, output->answer, field_opt->answer,
 		     col->answer, nrows, use, value, value_type,
 		     rgbcol_opt->answer, label_opt->answer, type))
       exit(EXIT_FAILURE);

Modified: grass/trunk/vector/v.to.rast/vect2rast.c
===================================================================
--- grass/trunk/vector/v.to.rast/vect2rast.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.rast/vect2rast.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -7,16 +7,14 @@
 #include "local.h"
 
 
-int vect_to_rast(const char *vector_map, const char *raster_map, int field,
+int vect_to_rast(const char *vector_map, const char *raster_map, const char *field_name,
 		 const char *column, int nrows, int use, double value,
 		 int value_type, const char *rgbcolumn, const char *labelcolumn,
 		 int ftype)
 {
-#ifdef DEBUG
-    int i;
-#endif
     struct Map_info Map;
     struct line_pnts *Points;
+    int i, field;
     int fd;			/* for raster map */
     int nareas, nlines;		/* number of converted features */
     int nareas_all, nplines_all;	/* number of all areas, points/lines */
@@ -34,9 +32,10 @@
 
     nareas = 0;
 
-    G_message(_("Loading data..."));
+    G_verbose_message(_("Loading data..."));
     Vect_set_open_level(2);
-    Vect_open_old(&Map, vector_map, "");
+    Vect_open_old2(&Map, vector_map, "", field_name);
+    field = Vect_get_field_number(&Map, field_name);
 
     if ((use == USE_Z) && !(Vect_is_3d(&Map)))
 	G_fatal_error(_("Vector map <%s> is not 3D"),
@@ -46,8 +45,8 @@
     case USE_ATTR:
 	db_CatValArray_init(&cvarr);
 	if (!(Fi = Vect_get_field(&Map, field)))
-	    G_fatal_error(_("Database connection not defined for layer %d"),
-			  field);
+	    G_fatal_error(_("Database connection not defined for layer <%s>"),
+			  field_name);
 
 	if ((Driver =
 	     db_start_driver_open_database(Fi->driver, Fi->database)) == NULL)
@@ -75,7 +74,6 @@
 
 	db_close_database_shutdown_driver(Driver);
 
-#ifdef DEBUG
 	for (i = 0; i < cvarr.n_values; i++) {
 	    if (ctype == DB_C_TYPE_INT) {
 		G_debug(3, "cat = %d val = %d", cvarr.value[i].cat,
@@ -86,8 +84,7 @@
 			cvarr.value[i].val.d);
 	    }
 	}
-#endif
-
+	
 	switch (ctype) {
 	case DB_C_TYPE_INT:
 	    format = USE_CELL;

Modified: grass/trunk/vector/v.to.rast3/main.c
===================================================================
--- grass/trunk/vector/v.to.rast3/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.to.rast3/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -5,12 +5,13 @@
  * AUTHOR(S):    Original s.to.rast3: Jaro Hofierka, Geomodel s.r.o. (original contributor)
  *               9/2005 Upgrade to GRASS 6 by Radim Blazek
  *               Soeren Gebbert <soeren.gebbert gmx.de>
- * PURPOSE:      
- * COPYRIGHT:    (C) 1999-2007 by the GRASS Development Team
+ *               OGR support by Martin Landa <landa.martin gmail.com>
+ * PURPOSE:      Converts vector points to 3D raster
+ * COPYRIGHT:    (C) 1999-2010 by the GRASS Development Team
  *
- *               This program is free software under the GNU General Public
- *               License (>=v2). Read the file COPYING that comes with GRASS
- *               for details.
+ *               This program is free software under the GNU General
+ *               Public License (>=v2). Read the file COPYING that
+ *               comes with GRASS for details.
  *
  *****************************************************************************/
 #include <stdlib.h>
@@ -41,44 +42,39 @@
     dbDriver *Driver;
     dbCatValArray cvarr;
 
+    G_gisinit(argv[0]);
+
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("volume"));
     G_add_keyword(_("conversion"));
-    module->description = _("Converts a binary GRASS vector map "
-			    "(only points) layer into a 3D GRASS raster map layer.");
+    module->description = _("Converts a vector map "
+			    "(only points) into a 3D raster map.");
 
     in_opt = G_define_standard_option(G_OPT_V_INPUT);
 
-    out_opt = G_define_standard_option(G_OPT_R3_OUTPUT);
-
-    col_opt = G_define_option();
-    col_opt->key = "column";
-    col_opt->type = TYPE_STRING;
-    col_opt->key_desc = "name";
-    col_opt->required = YES;
-    col_opt->multiple = NO;
-    col_opt->description = _("Column name (type must be numeric)");
-
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
 
-    G_gisinit(argv[0]);
+    out_opt = G_define_standard_option(G_OPT_R3_OUTPUT);
 
+    col_opt = G_define_standard_option(G_OPT_DB_COLUMN);
+    col_opt->required = YES;
+    col_opt->description = _("Name or attrbitute column (data type must be numeric)");
+    
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     G3d_getWindow(&region);
     G3d_readWindow(&region, NULL);
 
-    field = atoi(field_opt->answer);
-
     Vect_set_open_level(2);
-    Vect_open_old(&Map, in_opt->answer, "");
+    Vect_open_old2(&Map, in_opt->answer, "", field_opt->answer);
+    field = Vect_get_field_number(&Map, field_opt->answer);
 
     db_CatValArray_init(&cvarr);
     Fi = Vect_get_field(&Map, field);
     if (Fi == NULL)
-	G_fatal_error(_("Unable to get layer info for vector map"));
+	G_fatal_error(_("Database connection not defined for layer <%s>"), field_opt->answer);
 
     Driver = db_start_driver_open_database(Fi->driver, Fi->database);
     if (Driver == NULL)
@@ -113,7 +109,9 @@
     for (line = 1; line <= nlines; line++) {
 	int type, cat, depth, row, col, ret;
 	double value;
-
+	
+	G_percent(line, nlines, 2);
+	
 	type = Vect_read_line(&Map, Points, Cats, line);
 	if (!(type & GV_POINT))
 	    continue;
@@ -159,7 +157,6 @@
 
     if (!G3d_closeCell(map))
 	G_fatal_error(_("Unable to close new 3d raster map"));
-
-
+    
     exit(EXIT_SUCCESS);
 }

Modified: grass/trunk/vector/v.transform/creat_trans.c
===================================================================
--- grass/trunk/vector/v.transform/creat_trans.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.transform/creat_trans.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -29,7 +29,7 @@
 #include "trans.h"
 #include "local_proto.h"
 
-int create_transform_from_file(struct file_info *Coord, int quiet)
+int create_transform_from_file(struct file_info *Coord)
 {
     int status;
     int n_points;
@@ -50,7 +50,7 @@
 	G_fatal_error(_("Error creating transformation"));
     }
 
-    if (!quiet)
+    if (G_verbose() > G_verbose_std())
 	print_transform_resids(n_points);
 
     return (0);

Modified: grass/trunk/vector/v.transform/local_proto.h
===================================================================
--- grass/trunk/vector/v.transform/local_proto.h	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.transform/local_proto.h	2010-01-02 14:08:18 UTC (rev 40188)
@@ -3,7 +3,7 @@
 int set_default_options(struct file_info *, struct file_info *,
 			struct file_info *, struct command_flags *);
 /* creat_trans.c */
-int create_transform_from_file(struct file_info *, int);
+int create_transform_from_file(struct file_info *);
 
 /* get_coor.c */
 int get_coor_from_file(FILE *);

Modified: grass/trunk/vector/v.transform/main.c
===================================================================
--- grass/trunk/vector/v.transform/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.transform/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -5,12 +5,12 @@
 * AUTHOR(S):    See below also.
 *               Eric G. Miller <egm2 at jps.net>
 *               Upgrade to 5.7 Radim Blazek
-*               Column support added by Martin Landa (09/2007)
+*               Column support & OGR support added by Martin Landa (09/2007)
 *
 * PURPOSE:      To transform a vector map's coordinates via a set of tie
 *               points.
 *
-* COPYRIGHT:    (C) 2002-2007 by the GRASS Development Team
+* COPYRIGHT:    (C) 2002-2010 by the GRASS Development Team
 *
 *               This program is free software under the GNU General Public
 *   	    	License (>=v2). Read the file COPYING that comes with GRASS
@@ -61,7 +61,7 @@
 
     struct Option *vold, *vnew, *pointsfile, *xshift, *yshift, *zshift,
 	*xscale, *yscale, *zscale, *zrot, *columns, *table, *field;
-    struct Flag *quiet_flag, *tozero_flag, *shift_flag, *print_mat_flag;
+    struct Flag *tozero_flag, *print_mat_flag;
 
     char mon[4], date[40], buf[1000];
     struct Map_info Old, New;
@@ -85,12 +85,7 @@
     module->description =
 	_("Performs an affine transformation (shift, scale and rotate, "
 	  "or GPCs) on vector map.");
-
-    quiet_flag = G_define_flag();
-    quiet_flag->key = 'q';
-    quiet_flag->description =
-	_("Suppress display of residuals or other information");
-
+    
     tozero_flag = G_define_flag();
     tozero_flag->key = 't';
     tozero_flag->description = _("Shift all z values to bottom=0");
@@ -99,17 +94,12 @@
     print_mat_flag->key = 'm';
     print_mat_flag->description =
 	_("Print the transformation matrix to stdout");
-
-    /* remove in GRASS7 */
-    shift_flag = G_define_flag();
-    shift_flag->key = 's';
-    shift_flag->description =
-	_("Instead of points use transformation parameters "
-	  "(xshift, yshift, zshift, xscale, yscale, zscale, zrot)");
-    shift_flag->guisection = _("Custom");
-
+    
     vold = G_define_standard_option(G_OPT_V_INPUT);
 
+    field = G_define_standard_option(G_OPT_V_FIELD_ALL);
+    field->guisection = _("Custom");
+
     vnew = G_define_standard_option(G_OPT_V_OUTPUT);
 
     pointsfile = G_define_standard_option(G_OPT_F_INPUT);
@@ -119,8 +109,6 @@
     pointsfile->description = _("If not given, transformation parameters "
 				"(xshift, yshift, zshift, xscale, yscale, zscale, zrot) are used instead");
 
-    pointsfile->gisprompt = "old_file,file,points";
-
     xshift = G_define_option();
     xshift->key = "xshift";
     xshift->type = TYPE_DOUBLE;
@@ -197,9 +185,6 @@
 	_("Format: parameter:column, e.g. xshift:xs,yshift:ys,zrot:zr");
     columns->guisection = _("Custom");
 
-    field = G_define_standard_option(G_OPT_V_FIELD);
-    field->guisection = _("Custom");
-
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -208,18 +193,6 @@
 
     Vect_check_input_output_name(vold->answer, vnew->answer, GV_FATAL_EXIT);
 
-    /* please remove in GRASS7 */
-    if (shift_flag->answer)
-	G_warning(_("The '%c' flag is deprecated and will be removed in future. "
-		   "Transformation parameters are used automatically when no pointsfile is given."),
-		  shift_flag->key);
-
-    if (quiet_flag->answer) {
-	G_warning(_("The '%c' flag is deprecated and will be removed in future. "
-		   "Please use '--quiet' instead."), quiet_flag->key);
-	G_putenv("GRASS_VERBOSE", "0");
-    }
-
     if (!table->answer && columns->answer) {
 	G_fatal_error(_("Table name is not defined. Please use '%s' parameter."),
 		      table->key);
@@ -230,7 +203,7 @@
 		       "Otherwise the table is overwritten."));
     }
 
-    if (pointsfile->answer != NULL && !shift_flag->answer) {
+    if (pointsfile->answer != NULL) {
 	strcpy(Coord.name, pointsfile->answer);
     }
     else {
@@ -245,7 +218,7 @@
     }
 
     /* open vector maps */
-    Vect_open_old(&Old, vold->answer, "");
+    Vect_open_old2(&Old, vold->answer, "", field->answer);
 
     Vect_open_new(&New, vnew->answer, Vect_is_3d(&Old) || zshift->answer);
 
@@ -271,7 +244,7 @@
 
     /* points file */
     if (Coord.name[0]) {
-	create_transform_from_file(&Coord, quiet_flag->answer);
+	create_transform_from_file(&Coord);
 
 	if (Coord.name[0] != '\0')
 	    fclose(Coord.fp);
@@ -335,26 +308,26 @@
 
     transform_digit_file(&Old, &New, Coord.name[0] ? 1 : 0,
 			 ztozero, trans_params,
-			 table->answer, columns_name, atoi(field->answer));
+			 table->answer, columns_name, Vect_get_field_number(&Old, field->answer));
 
     if (Vect_copy_tables(&Old, &New, 0))
         G_warning(_("Failed to copy attribute table to output map"));
     Vect_close(&Old);
     Vect_build(&New);
 
-    if (!quiet_flag->answer) {
+    if (G_verbose() > G_verbose_std()) {
 	Vect_get_map_box(&New, &box);
 	G_message(_("\nNew vector map <%s> boundary coordinates:"),
 		  vnew->answer);
 	G_message(_(" N: %-10.3f    S: %-10.3f"), box.N, box.S);
 	G_message(_(" E: %-10.3f    W: %-10.3f"), box.E, box.W);
 	G_message(_(" B: %6.3f    T: %6.3f"), box.B, box.T);
-
-	/* print the transformation matrix if requested */
-	if (print_mat_flag->answer)
-	    print_transform_matrix();
     }
 
+    /* print the transformation matrix if requested */
+    if (print_mat_flag->answer)
+      print_transform_matrix();
+    
     Vect_close(&New);
 
     G_done_msg(" ");

Modified: grass/trunk/vector/v.transform/trans_digit.c
===================================================================
--- grass/trunk/vector/v.transform/trans_digit.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.transform/trans_digit.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -74,6 +74,9 @@
 	if (type == -2)		/* EOF */
 	    return 1;
 
+	if (field != -1 && !Vect_cat_get(Cats, field, NULL))
+	    continue;
+	
 	/* get transformation parameters */
 	if (table) {
 	    Vect_cat_get(Cats, field, &cat);	/* get first category */

Modified: grass/trunk/vector/v.type/main.c
===================================================================
--- grass/trunk/vector/v.type/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.type/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -4,21 +4,19 @@
  * MODULE:       v.type
  * 
  * AUTHOR(S):    Radim Blazek
+ *               OGR support by Martin Landa <landa.martin gmail.com>               
+ *
+ * PURPOSE:      Feature type manipulations
  *               
- * PURPOSE:      Category manipulations
- *               
- * COPYRIGHT:    (C) 2001 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2001-2010 by the GRASS Development Team
  *
- *               This program is free software under the 
- *               GNU General Public License (>=v2). 
- *               Read the file COPYING that comes with GRASS
- *               for details.
+ *               This program is free software under the GNU General
+ *               Public License (>=v2).  Read the file COPYING that
+ *               comes with GRASS for details.
  *
  **************************************************************/
-#ifdef FOR_GRASS7
-#include <string.h>
-#endif
 
+#include <string.h>
 #include <stdlib.h>
 #include <grass/gis.h>
 #include <grass/vector.h>
@@ -29,68 +27,44 @@
     struct Map_info In, Out;
     static struct line_pnts *Points;
     struct line_cats *Cats;
-    int type;
+    int type, field;
     struct GModule *module;
 
-#ifdef FOR_GRASS7
-    struct Option *in_opt, *out_opt, *to_opt, *from_opt;
+    struct Option *in_opt, *out_opt, *to_opt, *from_opt, *field_opt;
     int from_type, to_type;
-#else
-    int i, j;
-    struct Option *in_opt, *out_opt, *type_opt;
-    int types[100];		/* array of input,output types */
-    int ntypes;			/* number of types (number of pairs * 2) */
-#endif
 
+    G_gisinit(argv[0]);
+
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("geometry"));
-    module->description = _("Change the type of geometry elements.");
+    module->description = _("Changes type of vector features.");
 
     in_opt = G_define_standard_option(G_OPT_V_INPUT);
+
+    field_opt = G_define_standard_option(G_OPT_V_FIELD_ALL);
+    
     out_opt = G_define_standard_option(G_OPT_V_OUTPUT);
 
-#ifdef FOR_GRASS7
-    from_opt = G_define_option();
-    from_opt->type = TYPE_STRING;
-    from_opt->key = "from";
-    from_opt->key_desc = "type";
+    from_opt = G_define_standard_option(G_OPT_V_TYPE);
+    from_opt->key = "from_type";
     from_opt->options = "point,line,boundary,centroid,face,kernel";
-    from_opt->answer = "boundary";
     from_opt->required = YES;
-    from_opt->multiple = NO;
     from_opt->description = _("Feature type to convert from");
+    from_opt->answer = "line";
 
-    to_opt = G_define_option();
-    to_opt->type = TYPE_STRING;
-    to_opt->key = "to";
-    to_opt->key_desc = "type";
+    to_opt = G_define_standard_option(G_OPT_V_TYPE);
+    to_opt->key = "to_type";
     to_opt->options = "point,line,boundary,centroid,face,kernel";
-    to_opt->answer = "line";
     to_opt->required = YES;
-    to_opt->multiple = NO;
     to_opt->description = _("Feature type to convert to");
-#else
-    type_opt = G_define_standard_option(G_OPT_V_TYPE);
-    type_opt->options = "point,line,boundary,centroid,face,kernel";
-    type_opt->answer = "line,boundary,point,centroid";
-    type_opt->label = _("Pairs for input and output type separated by comma");
-    type_opt->description =
-	_("<input_type1>,<output_type1>,<input_type2>,<output_type2>,...\n"
-	  "\t\tExample1: line,boundary\n"
-	  "\t\tExample2: line,boundary,point,centroid");
-#endif
-
-
-    G_gisinit(argv[0]);
-
+    to_opt->answer = "boundary";
+    
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-#ifdef FOR_GRASS7
-    if (!strcmp(from_opt->answer, to_opt->answer))
-	G_fatal_error(_("Nothing to do"));
-
+    Vect_check_input_output_name(in_opt->answer, out_opt->answer, GV_FATAL_EXIT);
+			    
     switch (from_opt->answer[0]) {
     case 'p':
 	from_type = GV_POINT;
@@ -140,57 +114,6 @@
 	)
 	G_fatal_error(_("Incompatible types"));
 
-#else
-    i = 0;
-    j = 0;
-    while (type_opt->answers[i]) {
-	switch (type_opt->answers[i][0]) {
-	case 'p':
-	    types[i] = GV_POINT;
-	    break;
-	case 'l':
-	    types[i] = GV_LINE;
-	    break;
-	case 'b':
-	    types[i] = GV_BOUNDARY;
-	    break;
-	case 'c':
-	    types[i] = GV_CENTROID;
-	    break;
-	case 'f':
-	    types[i] = GV_FACE;
-	    break;
-	case 'k':
-	    types[i] = GV_KERNEL;
-	    break;
-	}
-	if (j == 1) {		/* check type compatibility */
-	    if (((types[i - 1] & (GV_POINT | GV_CENTROID | GV_KERNEL)) &&
-		 (types[i] & (GV_LINE | GV_BOUNDARY | GV_FACE))
-		) || ((types[i - 1] & (GV_LINE | GV_BOUNDARY | GV_FACE)) &&
-		      (types[i] & (GV_POINT | GV_CENTROID | GV_KERNEL))
-		)
-		) {
-		G_fatal_error(_("Incompatible types"));
-	    }
-	    j = 0;
-	}
-	else {
-	    j++;
-	}
-
-	i++;
-    }
-
-    if (i < 2)
-	G_fatal_error(_("Not enough types"));
-
-    if (j == 1)
-	G_fatal_error(_("Odd number of types"));
-
-    ntypes = i;
-#endif
-
     Vect_check_input_output_name(in_opt->answer, out_opt->answer,
 				 GV_FATAL_EXIT);
 
@@ -199,8 +122,9 @@
 
     /* open input vector */
     Vect_set_open_level(1);
-    Vect_open_old(&In, in_opt->answer, "");
-
+    Vect_open_old2(&In, in_opt->answer, "", field_opt->answer);
+    field = Vect_get_field_number(&In, field_opt->answer);
+    
     Vect_set_fatal_error(GV_FATAL_PRINT);
     if (0 > Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In))) {
 	Vect_close(&In);
@@ -212,22 +136,18 @@
     Vect_hist_command(&Out);
 
     while ((type = Vect_read_next_line(&In, Points, Cats)) > 0) {
-#ifdef FOR_GRASS7
 	if (type == from_type)
 	    type = to_type;
-#else
-	for (i = 0; i < ntypes; i += 2) {
-	    if (type == types[i]) {
-		type = types[i + 1];
-		break;
-	    }
-	}
-#endif
+
+	if (field != -1 && !Vect_cat_get(Cats, field, NULL))
+	    continue;
+
 	Vect_write_line(&Out, type, Points, Cats);
     }
 
     if (Vect_copy_tables(&In, &Out, 0))
         G_warning(_("Failed to copy attribute table to output map"));
+
     Vect_build(&Out);
     Vect_close(&Out);
     Vect_close(&In);

Modified: grass/trunk/vector/v.univar/main.c
===================================================================
--- grass/trunk/vector/v.univar/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.univar/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -5,16 +5,15 @@
  * 
  * AUTHOR(S):    Radim Blazek
  *               Hamish Bowman, University of Otago, New Zealand (r.univar2)
- *               Martin Landa (extended stats)
+ *               Martin Landa (extended stats & OGR support)
  *               
  * PURPOSE:      Univariate Statistics for attribute
  *               
- * COPYRIGHT:    (C) 2004-2007 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2004-2010 by the GRASS Development Team
  *
- *               This program is free software under the 
- *               GNU General Public License (>=v2). 
- *               Read the file COPYING that comes with GRASS
- *               for details.
+ *               This program is free software under the GNU General
+ *               Public License (>=v2).  Read the file COPYING that
+ *               comes with GRASS for details.
  *
  **************************************************************/
 #include <stdlib.h>
@@ -63,26 +62,23 @@
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("statistics"));
-    module->description =
-	_("Calculates univariate statistics for attribute. Variance and standard "
-	 "deviation is calculated only for points if specified.");
+    module->label =
+	_("Calculates univariate statistics for attribute.");
+    module->description = _("Variance and standard "
+			    "deviation is calculated only for points if specified.");
 
     map_opt = G_define_standard_option(G_OPT_V_MAP);
 
+    field_opt = G_define_standard_option(G_OPT_V_FIELD);
+
     type_opt = G_define_standard_option(G_OPT_V_TYPE);
     type_opt->options = "point,line,boundary,centroid,area";
 
-    col_opt = G_define_option();
-    col_opt->key = "column";
-    col_opt->type = TYPE_STRING;
+    col_opt = G_define_standard_option(G_OPT_DB_COLUMN);
     col_opt->required = YES;
-    col_opt->multiple = NO;
-    col_opt->description = _("Column name");
 
     where_opt = G_define_standard_option(G_OPT_DB_WHERE);
 
-    field_opt = G_define_standard_option(G_OPT_V_FIELD);
-
     percentile = G_define_option();
     percentile->key = "percentile";
     percentile->type = TYPE_INTEGER;
@@ -101,11 +97,11 @@
     extended->description = _("Calculate extended statistics");
 
     G_gisinit(argv[0]);
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     otype = Vect_option_to_types(type_opt);
-    ofield = atoi(field_opt->answer);
     perc = atoi(percentile->answer);
 
     Points = Vect_new_line_struct();
@@ -113,7 +109,8 @@
 
     /* open input vector */
     Vect_set_open_level(2);
-    Vect_open_old(&Map, map_opt->answer, "");
+    Vect_open_old2(&Map, map_opt->answer, "", field_opt->answer);
+    ofield = Vect_get_field_number(&Map, field_opt->answer);
 
     /* Check if types are compatible */
     if ((otype & GV_POINTS) && ((otype & GV_LINES) || (otype & GV_AREA)))
@@ -134,7 +131,7 @@
     db_CatValArray_init(&Cvarr);
     Fi = Vect_get_field(&Map, ofield);
     if (Fi == NULL) {
-	G_fatal_error(_("Unable to get layer info for vector map"));
+	G_fatal_error(_(" Database connection not defined for layer <%s>"), field_opt->answer);
     }
 
     Driver = db_start_driver_open_database(Fi->driver, Fi->database);

Modified: grass/trunk/vector/v.what/main.c
===================================================================
--- grass/trunk/vector/v.what/main.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.what/main.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -4,17 +4,18 @@
  * MODULE:       v.what
  *
  * AUTHOR(S):    Trevor Wiens - derived from d.what.vect - 15 Jan 2006
+ *               OGR support by Martin Landa <landa.martin gmail.com>
  *
  * PURPOSE:      To select and report attribute information for objects at a
  *               user specified location. This replaces d.what.vect by removing
  *               the interactive component to enable its use with the new 
  *               gis.m and future GUI.
  *
- * COPYRIGHT:    (C) 2006 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2006-2010 by the GRASS Development Team
  *
- *               This program is free software under the GNU General Public
- *              License (>=v2). Read the file COPYING that comes with GRASS
- *              for details.
+ *               This program is free software under the GNU General
+ *               Public License (>=v2). Read the file COPYING that
+ *               comes with GRASS for details.
  *
  *****************************************************************************/
 
@@ -36,11 +37,12 @@
 int main(int argc, char **argv)
 {
     struct Flag *printattributes, *topo_flag, *shell_flag;
-    struct Option *opt1, *coords_opt, *maxdistance;
+    struct Option *map_opt, *field_opt, *coords_opt, *maxdistance;
     struct Cell_head window;
     struct GModule *module;
     char buf[2000];
     int i, level, ret;
+    int *field;
     double xval, yval, xres, yres, maxd, x;
     double EW_DIST1, EW_DIST2, NS_DIST1, NS_DIST2;
     char nsres[30], ewres[30];
@@ -52,12 +54,12 @@
     module = G_define_module();
     G_add_keyword(_("vector"));
     G_add_keyword(_("querying"));
-    module->description = _("Queries a vector map layer at given locations.");
+    module->description = _("Queries a vector map at given locations.");
 
-    opt1 = G_define_standard_option(G_OPT_V_MAP);
-    opt1->multiple = YES;
-    opt1->required = YES;
+    map_opt = G_define_standard_option(G_OPT_V_MAPS);
 
+    field_opt = G_define_standard_option(G_OPT_V_FIELD_ALL);
+    
     coords_opt = G_define_option();
     coords_opt->key = "east_north";
     coords_opt->type = TYPE_DOUBLE;
@@ -65,7 +67,7 @@
     coords_opt->required = NO;
     coords_opt->multiple = YES;
     coords_opt->label = _("Coordinates for query");
-    coords_opt->description = _("If not given reads from standard input");
+    coords_opt->description = _("If not given read from standard input");
 
     maxdistance = G_define_option();
     maxdistance->type = TYPE_DOUBLE;
@@ -77,20 +79,23 @@
     topo_flag = G_define_flag();
     topo_flag->key = 'd';
     topo_flag->description = _("Print topological information (debugging)");
+    topo_flag->guisection = _("Print");
 
     printattributes = G_define_flag();
     printattributes->key = 'a';
     printattributes->description = _("Print attribute information");
+    printattributes->guisection = _("Print");
 
     shell_flag = G_define_flag();
     shell_flag->key = 'g';
     shell_flag->description = _("Print the stats in shell script style");
+    shell_flag->guisection = _("Print");
 
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-    if (opt1->answers && opt1->answers[0])
-	vect = opt1->answers;
+    if (map_opt->answers && map_opt->answers[0])
+	vect = map_opt->answers;
 
     maxd = atof(maxdistance->answer);
 
@@ -129,28 +134,39 @@
 
     /* Look at maps given on command line */
     if (vect) {
-	for (i = 0; vect[i]; i++) ;
+
+	for (i = 0; vect[i]; i++)
+	    ;
 	nvects = i;
 
-	Map = (struct Map_info *)G_malloc(nvects * sizeof(struct Map_info));
-
+	for (i = 0; field_opt->answers[i]; i++)
+	    ;
+	
+	if (nvects != i)
+	    G_fatal_error(_("Number of given vector maps (%d) differs from number of layers (%d)"),
+			  nvects, i);
+	
+	Map = (struct Map_info *) G_malloc(nvects * sizeof(struct Map_info));
+	field = (int *) G_malloc(nvects * sizeof(int));
+	
 	for (i = 0; i < nvects; i++) {
-	    level = Vect_open_old(&Map[i], vect[i], "");
+	    level = Vect_open_old2(&Map[i], vect[i], "", field_opt->answers[i]);
 	    if (level < 2)
 		G_fatal_error(_("You must build topology on vector map <%s>"),
 			      vect[i]);
+	    field[i] = Vect_get_field_number(&Map[i], field_opt->answers[i]);
 	}
     }
 
     if (!coords_opt->answer) {
-	/* if coords are not given on command line, read them from stdin */
+	/* read them from stdin */
 	setvbuf(stdin, NULL, _IOLBF, 0);
 	setvbuf(stdout, NULL, _IOLBF, 0);
 	while (fgets(buf, sizeof(buf), stdin) != NULL) {
 	    ret = sscanf(buf, "%lf%c%lf", &xval, &ch, &yval);
 	    if (ret == 3 && (ch == ',' || ch == ' ' || ch == '\t')) {
 		what(xval, yval, maxd, topo_flag->answer,
-		     printattributes->answer, shell_flag->answer);
+		     printattributes->answer, shell_flag->answer, field);
 	    }
 	    else {
 		G_warning(_("Unknown input format, skipping: '%s'"), buf);
@@ -163,7 +179,8 @@
 	for (i = 0; coords_opt->answers[i] != NULL; i += 2) {
 	    xval = atof(coords_opt->answers[i]);
 	    yval = atof(coords_opt->answers[i + 1]);
-	    what(xval, yval, maxd, topo_flag->answer, printattributes->answer, shell_flag->answer);
+	    what(xval, yval, maxd, topo_flag->answer,
+		 printattributes->answer, shell_flag->answer, field);
 	}
     }
 

Modified: grass/trunk/vector/v.what/what.c
===================================================================
--- grass/trunk/vector/v.what/what.c	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.what/what.c	2010-01-02 14:08:18 UTC (rev 40188)
@@ -102,7 +102,7 @@
     db_free_string(&str);
 }
 
-void what(double east, double north, double maxdist, int topo, int showextra, int script)
+void what(double east, double north, double maxdist, int topo, int showextra, int script, int *field)
 {
     int type;
     char east_buf[40], north_buf[40];
@@ -199,6 +199,10 @@
 
 	if (line > 0) {
 	    type = Vect_read_line(&Map[i], Points, Cats, line);
+
+	    if (field[i] != -1 && !Vect_cat_get(Cats, field[i], NULL))
+	      continue;
+	    
 	    switch (type) {
 	    case GV_POINT:
 		sprintf(buf, "Point\n");

Modified: grass/trunk/vector/v.what/what.h
===================================================================
--- grass/trunk/vector/v.what/what.h	2010-01-02 14:05:31 UTC (rev 40187)
+++ grass/trunk/vector/v.what/what.h	2010-01-02 14:08:18 UTC (rev 40188)
@@ -1,5 +1,5 @@
 /* what.c */
-extern void what(double, double, double, int, int, int);
+extern void what(double, double, double, int, int, int, int*);
 
 extern char **vect;
 extern int nvects;



More information about the grass-commit mailing list