[GRASS-SVN] r40729 - grass/trunk/vector/v.in.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 28 18:01:51 EST 2010
Author: huhabla
Date: 2010-01-28 18:01:49 -0500 (Thu, 28 Jan 2010)
New Revision: 40729
Modified:
grass/trunk/vector/v.in.ogr/main.c
Log:
Added the flag "i" (same as in r.in.gdal).
This flag allows the creation of a location based on the input map without actually importing the map.
Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c 2010-01-28 20:44:51 UTC (rev 40728)
+++ grass/trunk/vector/v.in.ogr/main.c 2010-01-28 23:01:49 UTC (rev 40729)
@@ -57,7 +57,7 @@
struct Option *snap_opt, *type_opt, *outloc_opt, *cnames_opt;
struct Flag *list_flag, *no_clean_flag, *z_flag, *notab_flag,
*region_flag;
- struct Flag *over_flag, *extend_flag, *formats_flag, *tolower_flag;
+ struct Flag *over_flag, *extend_flag, *formats_flag, *tolower_flag, *no_import_flag;
char buf[2000], namebuf[2000], tempvect[2000];
char *separator;
struct Key_Value *loc_proj_info = NULL, *loc_proj_units = NULL;
@@ -236,6 +236,12 @@
_("Change column names to lowercase characters");
tolower_flag->guisection = _("Attributes");
+ no_import_flag = G_define_flag();
+ no_import_flag->key = 'i';
+ no_import_flag->description =
+ _("Create the location specified by the \"location\" parameter and exit."
+ " Do not import the vector 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 */
@@ -472,12 +478,21 @@
/* Convert projection information non-interactively as we can't
* assume the user has a terminal open */
if (GPJ_osr_to_grass(&cellhd, &proj_info,
- &proj_units, Ogr_projection, 0) < 0)
+ &proj_units, Ogr_projection, 0) < 0) {
G_fatal_error(_("Unable to convert input map projection to GRASS "
- "format; cannot create new location"));
- else
+ "format; cannot create new location."));
+ }
+ else {
G_make_location(outloc_opt->answer, &cellhd,
proj_info, proj_units, NULL);
+ G_message(_("Location <%s> created"), outloc_opt->answer);
+ }
+
+ /* If the i flag is set, clean up? and exit here */
+ if(no_import_flag->answer)
+ {
+ exit(EXIT_SUCCESS);
+ }
}
else {
int err = 0;
More information about the grass-commit
mailing list