[GRASS-SVN] r44436 - grass/trunk/raster/r.out.gdal

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 26 13:23:07 EST 2010


Author: martinl
Date: 2010-11-26 10:23:07 -0800 (Fri, 26 Nov 2010)
New Revision: 44436

Modified:
   grass/trunk/raster/r.out.gdal/main.c
Log:
r.out.gdal: suppress required for -l


Modified: grass/trunk/raster/r.out.gdal/main.c
===================================================================
--- grass/trunk/raster/r.out.gdal/main.c	2010-11-26 17:41:46 UTC (rev 44435)
+++ grass/trunk/raster/r.out.gdal/main.c	2010-11-26 18:23:07 UTC (rev 44436)
@@ -133,6 +133,7 @@
     flag_l->key = 'l';
     flag_l->description = _("List supported output formats");
     flag_l->guisection = _("Print");
+    flag_l->suppress_required = TRUE;
 
     flag_c = G_define_flag();
     flag_c->key = 'c';
@@ -145,10 +146,11 @@
     flag_f->description = _("Overrides nodata safety check.");
 
     input = G_define_standard_option(G_OPT_R_INPUT);
-    input->required = NO;
     input->description = _("Name of raster map (or group) to export");
-    input->guisection = _("Required");
 
+    output = G_define_standard_option(G_OPT_F_OUTPUT);
+    output->description = _("Name for output raster file");
+
     format = G_define_option();
     format->key = "format";
     format->type = TYPE_STRING;
@@ -170,7 +172,8 @@
 #endif
     format->answer = "GTiff";
     format->required = NO;
-
+    format->guisection = _("Format");
+    
     type = G_define_option();
     type->key = "type";
     type->type = TYPE_STRING;
@@ -178,13 +181,8 @@
     type->options =
 	"Byte,Int16,UInt16,Int32,UInt32,Float32,Float64,CInt16,CInt32,CFloat32,CFloat64";
     type->required = NO;
+    type->guisection = _("Format");
 
-    output = G_define_standard_option(G_OPT_R_OUTPUT);
-    output->required = NO;
-    output->gisprompt = "new_file,file,output";
-    output->description = _("Name for output raster file");
-    output->guisection = _("Required");
-
     createopt = G_define_option();
     createopt->key = "createopt";
     createopt->type = TYPE_STRING;
@@ -227,10 +225,7 @@
 	supported_formats(&gdal_formats);
 	exit(EXIT_SUCCESS);
     }
-
-    if (!input->answer)
-	G_fatal_error(_("Required parameter <%s> not set"), input->key);
-
+    
     /* Try to open input GRASS raster.. */
     mapset = G_find_raster2(input->answer, "");
 
@@ -408,8 +403,8 @@
     }
 
     /* got a GDAL datatype, report to user */
-    G_message(_("Exporting to GDAL data type: %s"),
-	      GDALGetDataTypeName(datatype));
+    G_verbose_message(_("Exporting to GDAL data type: %s"),
+		      GDALGetDataTypeName(datatype));
 
     G_debug(3, "Input map datatype=%s\n",
 	    (maptype == CELL_TYPE ? "CELL" :
@@ -488,7 +483,7 @@
     }
 
     /* exact range and nodata checks for each band */
-    G_message(_("Checking GDAL data type and nodata value"));
+    G_message(_("Checking GDAL data type and nodata value..."));
     for (band = 0; band < ref.nfiles; band++) {
 	if (ref.nfiles > 1) {
 	    G_verbose_message(_("Checking options for raster map <%s> (band %d)..."),
@@ -531,8 +526,6 @@
 
     GDALDatasetH hCurrDS = NULL, hMEMDS = NULL, hDstDS = NULL;
 
-    if (!output->answer)
-	G_fatal_error(_("Output file name not specified"));
     if (hMEMDriver) {
 	hMEMDS =
 	    GDALCreate(hMEMDriver, "", cellhead.cols, cellhead.rows,
@@ -576,7 +569,7 @@
     AttachMetadata(hCurrDS, metaopt->answers);
 
     /* Export to GDAL raster */
-    G_message(_("Exporting to GDAL raster"));
+    G_message(_("Exporting raster data to %s format..."), format->answer);
     for (band = 0; band < ref.nfiles; band++) {
 	if (ref.nfiles > 1) {
 	    G_verbose_message(_("Exporting raster map <%s> (band %d)..."),
@@ -615,7 +608,7 @@
 
     CSLDestroy(papszOptions);
 
-    G_done_msg(" ");
+    G_done_msg("File <%s> created.", output->answer);
     exit(EXIT_SUCCESS);
 }
 



More information about the grass-commit mailing list