[GRASS-SVN] r57333 - grass/trunk/raster/r.to.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 31 10:53:13 PDT 2013


Author: mmetz
Date: 2013-07-31 10:53:12 -0700 (Wed, 31 Jul 2013)
New Revision: 57333

Modified:
   grass/trunk/raster/r.to.vect/main.c
Log:
r.to.vect: add option to not create an attribute table (#2051)

Modified: grass/trunk/raster/r.to.vect/main.c
===================================================================
--- grass/trunk/raster/r.to.vect/main.c	2013-07-31 17:45:15 UTC (rev 57332)
+++ grass/trunk/raster/r.to.vect/main.c	2013-07-31 17:53:12 UTC (rev 57333)
@@ -60,8 +60,8 @@
 {
     struct GModule *module;
     struct Option *in_opt, *out_opt, *feature_opt, *column_name;
-    struct Flag *smooth_flg, *value_flg, *z_flg, *no_topol;
-    int feature;
+    struct Flag *smooth_flg, *value_flg, *z_flg, *no_topol, *notab_flg;
+    int feature, notab_flag;
 
 
     G_gisinit(argv[0]);
@@ -110,12 +110,15 @@
     no_topol->label = _("Do not build vector topology");
     no_topol->description = _("Recommended for massive point conversion");
 
+    notab_flg = G_define_standard_flag(G_FLG_V_TABLE);
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
     feature = Vect_option_to_types(feature_opt);
     smooth_flag = (smooth_flg->answer) ? SMOOTH : NO_SMOOTH;
     value_flag = value_flg->answer;
+    notab_flag = notab_flg->answer;
 
     if (z_flg->answer && (feature != GV_POINT))
 	G_fatal_error(_("z flag is supported only for points"));
@@ -128,10 +131,19 @@
     G_get_window(&cell_head);
 
     if (value_flag && data_type != CELL_TYPE) {
-	G_warning(_("Raster is not CELL, '-v' flag ignored, raster values will be written to the table."));
+	if (!notab_flag)
+	    G_warning(_("Raster is not CELL, '-v' flag ignored, raster values will be written to the table."));
+	else if (z_flg->answer)
+	    G_warning(_("Raster is not CELL, '-v' flag ignored, raster values will be z coordinate."));
+	else
+	    G_warning(_("Raster is not CELL, '-v' flag ignored, raster values will be lost."));
 	value_flag = 0;
     }
 
+    if (!value_flag && notab_flag) {
+	G_warning(_("Categories will be unique sequence, raster values will be lost."));
+    }
+
     if (z_flg->answer)
 	Vect_open_new(&Map, out_opt->answer, 1);
     else
@@ -154,7 +166,8 @@
 
     /* Create table */
     if ((feature & (GV_AREA | GV_POINT | GV_LINE)) &&
-	(!value_flag || (value_flag && has_cats)) && !(z_flg->answer)) {
+	(!value_flag || (value_flag && has_cats)) && !(z_flg->answer)
+	&& !notab_flag) {
 	char buf[1000];
 
 	Fi = Vect_default_field_info(&Map, 1, NULL, GV_1TABLE);



More information about the grass-commit mailing list