[GRASS-SVN] r40075 - grass/trunk/raster/r.in.gdal
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Dec 19 15:54:21 EST 2009
Author: huhabla
Date: 2009-12-19 15:54:20 -0500 (Sat, 19 Dec 2009)
New Revision: 40075
Modified:
grass/trunk/raster/r.in.gdal/main.c
Log:
Added c flag to create a location based on the projection information of the raster file and exit. The raster file will not be imported into the new created location.
Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c 2009-12-19 20:13:58 UTC (rev 40074)
+++ grass/trunk/raster/r.in.gdal/main.c 2009-12-19 20:54:20 UTC (rev 40075)
@@ -69,7 +69,7 @@
{
struct Option *input, *output, *target, *title, *outloc, *band;
} parm;
- struct Flag *flag_o, *flag_e, *flag_k, *flag_f, *flag_l;
+ struct Flag *flag_o, *flag_e, *flag_k, *flag_f, *flag_l, *flag_c;
/* -------------------------------------------------------------------- */
/* Initialize. */
@@ -146,6 +146,12 @@
flag_k->description =
_("Keep band numbers instead of using band color names");
+ flag_c = G_define_flag();
+ flag_c->key = 'c';
+ flag_c->description =
+ _("Create the location specified by the \"location\" parameter and exit."
+ " Do not import the raster file.");
+
/* The parser checks if the map already exists in current mapset, this is
* wrong if location options is used, so we switch out the check and do it
* in the module after the parser */
@@ -168,6 +174,10 @@
G_fatal_error(_("You have to specify a target location different from output location"));
}
+ if (flag_c->answer && parm.outloc->answer == NULL ) {
+ G_fatal_error(_("You need to specify valid location name."));
+ }
+
if (flag_l->answer && G_projection() != PROJECTION_LL)
G_fatal_error(_("The '-l' flag only works in Lat/Lon locations"));
@@ -319,6 +329,12 @@
proj_info, proj_units, NULL);
G_message(_("Location <%s> created"), parm.outloc->answer);
}
+
+ /* If the c flag is set, clean up? and exit here */
+ if(flag_c->answer)
+ {
+ exit(EXIT_SUCCESS);
+ }
}
else {
/* Projection only required for checking so convert non-interactively */
More information about the grass-commit
mailing list