Browse Source

v.out.ogr: --o adds OVERWRITE=YES to lcos

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39580 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 years ago
parent
commit
e8c08a9ff5
1 changed files with 10 additions and 3 deletions
  1. 10 3
      vector/v.out.ogr/main.c

+ 10 - 3
vector/v.out.ogr/main.c

@@ -287,9 +287,16 @@ int main(int argc, char *argv[])
 		      options.dsn->answer);
 
     /* check if OGR layer exists */
-    if (!G_check_overwrite(argc, argv) && OGR_DS_GetLayerByName(Ogr_ds, options.layer->answer)) {
-	G_fatal_error(_("OGR layer <%s> already exists in '%s'"),
-		options.layer->answer, options.dsn->answer);
+    if (OGR_DS_GetLayerByName(Ogr_ds, options.layer->answer)) {
+	if (!G_check_overwrite(argc, argv)) {
+	    G_fatal_error(_("OGR layer <%s> already exists in '%s'"),
+			  options.layer->answer, options.dsn->answer);
+	}
+	else {
+	    G_warning(_("OGR layer <%s> already exists and will be overwritten"),
+		      options.layer->answer);
+	    papszLCO = CSLSetNameValue(papszLCO, "OVERWRITE", "YES");
+	}
     }
     
     /* check if the map is 3d */