[GRASS-SVN] r62251 - in grass/branches/releasebranch_7_0: . vector/v.out.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Oct 14 11:56:33 PDT 2014
Author: neteler
Date: 2014-10-14 11:56:33 -0700 (Tue, 14 Oct 2014)
New Revision: 62251
Modified:
grass/branches/releasebranch_7_0/
grass/branches/releasebranch_7_0/vector/v.out.ogr/args.c
grass/branches/releasebranch_7_0/vector/v.out.ogr/main.c
Log:
v.out.ogr: fix append mode (trunk, r62144)
Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Added: svn:mergeinfo
+ /grass/trunk:62144
Modified: grass/branches/releasebranch_7_0/vector/v.out.ogr/args.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.out.ogr/args.c 2014-10-14 13:48:18 UTC (rev 62250)
+++ grass/branches/releasebranch_7_0/vector/v.out.ogr/args.c 2014-10-14 18:56:33 UTC (rev 62251)
@@ -87,7 +87,8 @@
flags->append = G_define_flag();
flags->append->key = 'a';
- flags->append->description = _("Append to existing layer instead of creating new if it exists");
+ flags->append->label = _("Append to existing layer");
+ flags->append->description = _("A new OGR layer is created if it does not exist");
flags->nocat = G_define_flag();
flags->nocat->key = 's';
Modified: grass/branches/releasebranch_7_0/vector/v.out.ogr/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.out.ogr/main.c 2014-10-14 13:48:18 UTC (rev 62250)
+++ grass/branches/releasebranch_7_0/vector/v.out.ogr/main.c 2014-10-14 18:56:33 UTC (rev 62251)
@@ -190,6 +190,10 @@
if (!options.layer->answer) {
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
+ if (flags.append->answer)
+ G_fatal_error(_("Appending to OGR layer requires option '%s'"),
+ options.layer->key);
+
if (G_name_is_fully_qualified(options.input->answer, xname, xmapset))
options.layer->answer = G_store(xname);
else
@@ -456,22 +460,27 @@
Ogr_driver = OGRGetDriver(drn);
if (flags.append->answer) {
- G_verbose_message(_("Append existing layer requires "
- "opening data source in update mode, forcing '-%c' flag"),
- flags.update->key);
- flags.update->answer = TRUE;
- }
-
- if (flags.update->answer) {
- G_debug(1, "Update OGR data source");
+ G_debug(1, "Append to OGR layer");
Ogr_ds = OGR_Dr_Open(Ogr_driver, options.dsn->answer, TRUE);
+
+ if (Ogr_ds == NULL) {
+ G_debug(1, "Create OGR data source");
+ Ogr_ds = OGR_Dr_CreateDataSource(Ogr_driver, options.dsn->answer,
+ papszDSCO);
+ }
}
else {
- G_debug(1, "Create OGR data source");
- Ogr_ds = OGR_Dr_CreateDataSource(Ogr_driver, options.dsn->answer,
- papszDSCO);
+ if (flags.update->answer) {
+ G_debug(1, "Update OGR data source");
+ Ogr_ds = OGR_Dr_Open(Ogr_driver, options.dsn->answer, TRUE);
+ }
+ else {
+ G_debug(1, "Create OGR data source");
+ Ogr_ds = OGR_Dr_CreateDataSource(Ogr_driver, options.dsn->answer,
+ papszDSCO);
+ }
}
-
+
CSLDestroy(papszDSCO);
if (Ogr_ds == NULL)
G_fatal_error(_("Unable to open OGR data source '%s'"),
More information about the grass-commit
mailing list