[GRASS-SVN] r60233 - grass/branches/releasebranch_7_0/raster/r.shaded.relief

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 13 22:09:58 PDT 2014


Author: neteler
Date: 2014-05-13 22:09:58 -0700 (Tue, 13 May 2014)
New Revision: 60233

Modified:
   grass/branches/releasebranch_7_0/raster/r.shaded.relief/main.c
Log:
r.shaded.relief: overwrite test added (from r.in.gdal)

Modified: grass/branches/releasebranch_7_0/raster/r.shaded.relief/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.shaded.relief/main.c	2014-05-13 21:17:32 UTC (rev 60232)
+++ grass/branches/releasebranch_7_0/raster/r.shaded.relief/main.c	2014-05-14 05:09:58 UTC (rev 60233)
@@ -78,6 +78,7 @@
     char buf[GNAME_MAX];
     int nrows, row;
     int ncols, col;
+    int overwrite=0;
 
     double zmult, scale, altitude, azimuth;
     double north, east, south, west, ns_med;
@@ -165,6 +166,9 @@
     degrees_to_radians = M_PI / 180.0;
     radians_to_degrees = 180. / M_PI;
 
+    /* Check due to default output map = input.shade map */
+    overwrite = G_check_overwrite(argc, argv);
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -183,6 +187,13 @@
     }
 
     G_check_input_output_name(elev_name, sr_name, G_FATAL_EXIT);
+    if (G_find_raster2(sr_name, G_mapset())) {
+        if (overwrite)
+            G_warning(_("Raster map <%s> already exists and will be overwritten"),
+			 sr_name);
+	    else
+            G_fatal_error(_("Raster map <%s> already exists"), sr_name);
+    }
 
     if (sscanf(parm.altitude->answer, "%lf", &altitude) != 1 || altitude < 0.0) {
 	G_fatal_error(_("%s=%s - must be a non-negative number"),



More information about the grass-commit mailing list