[GRASS-SVN] r71596 - in grass/trunk/raster: r.external r.in.gdal

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 25 12:03:46 PDT 2017


Author: mmetz
Date: 2017-10-25 12:03:46 -0700 (Wed, 25 Oct 2017)
New Revision: 71596

Modified:
   grass/trunk/raster/r.external/proj.c
   grass/trunk/raster/r.in.gdal/proj.c
Log:
r.in.gdal/r.external: fix error reporting (sync to v.in.ogr)

Modified: grass/trunk/raster/r.external/proj.c
===================================================================
--- grass/trunk/raster/r.external/proj.c	2017-10-25 18:56:51 UTC (rev 71595)
+++ grass/trunk/raster/r.external/proj.c	2017-10-25 19:03:46 UTC (rev 71596)
@@ -149,6 +149,30 @@
 			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
 				proj_info->key[i_value],
 				proj_info->value[i_value]);
+		}
+		else {
+		    strcat(error_msg, _("Dataset PROJ_INFO is:\n"));
+		    if (cellhd->proj == PROJECTION_XY)
+			sprintf(error_msg + strlen(error_msg),
+				"Dataset proj = %d (unreferenced/unknown)\n",
+				cellhd->proj);
+		    else if (cellhd->proj == PROJECTION_LL)
+			sprintf(error_msg + strlen(error_msg),
+				"Dataset proj = %d (lat/long)\n",
+				cellhd->proj);
+		    else if (cellhd->proj == PROJECTION_UTM)
+			sprintf(error_msg + strlen(error_msg),
+				"Dataset proj = %d (UTM), zone = %d\n",
+				cellhd->proj, cellhd->zone);
+		    else
+			sprintf(error_msg + strlen(error_msg),
+				"Dataset proj = %d (unknown), zone = %d\n",
+				cellhd->proj, cellhd->zone);
+		}
+		if (loc_wind.proj != cellhd->proj) {
+		    strcat(error_msg, "\nERROR: proj\n");
+		}
+		else {
 		    strcat(error_msg, "\nERROR: ");
 		    switch (err) {
 		    case -1:
@@ -186,25 +210,6 @@
 			break;
 		    }
 		}
-		else {
-		    strcat(error_msg, _("Dataset PROJ_INFO is:\n"));
-		    if (cellhd->proj == PROJECTION_XY)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (unreferenced/unknown)\n",
-				cellhd->proj);
-		    else if (cellhd->proj == PROJECTION_LL)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (lat/long)\n",
-				cellhd->proj);
-		    else if (cellhd->proj == PROJECTION_UTM)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (UTM), zone = %d\n",
-				cellhd->proj, cellhd->zone);
-		    else
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (unknown), zone = %d\n",
-				cellhd->proj, cellhd->zone);
-		}
 	    }
 	    else {
 		/* error in proj_units */
@@ -235,11 +240,12 @@
 		    "the 'location' parameter.\n"));
 
 	    if (check_only)
-		msg_fn = G_message;
+		msg_fn = G_warning;
 	    else
 		msg_fn = G_fatal_error;
 	    msg_fn(error_msg);
 	    if (check_only) {
+		GDALClose(hDS);
 		exit(EXIT_FAILURE);
 	    }
 	}

Modified: grass/trunk/raster/r.in.gdal/proj.c
===================================================================
--- grass/trunk/raster/r.in.gdal/proj.c	2017-10-25 18:56:51 UTC (rev 71595)
+++ grass/trunk/raster/r.in.gdal/proj.c	2017-10-25 19:03:46 UTC (rev 71596)
@@ -149,6 +149,30 @@
 			sprintf(error_msg + strlen(error_msg), "%s: %s\n",
 				proj_info->key[i_value],
 				proj_info->value[i_value]);
+		}
+		else {
+		    strcat(error_msg, _("Dataset PROJ_INFO is:\n"));
+		    if (cellhd->proj == PROJECTION_XY)
+			sprintf(error_msg + strlen(error_msg),
+				"Dataset proj = %d (unreferenced/unknown)\n",
+				cellhd->proj);
+		    else if (cellhd->proj == PROJECTION_LL)
+			sprintf(error_msg + strlen(error_msg),
+				"Dataset proj = %d (lat/long)\n",
+				cellhd->proj);
+		    else if (cellhd->proj == PROJECTION_UTM)
+			sprintf(error_msg + strlen(error_msg),
+				"Dataset proj = %d (UTM), zone = %d\n",
+				cellhd->proj, cellhd->zone);
+		    else
+			sprintf(error_msg + strlen(error_msg),
+				"Dataset proj = %d (unknown), zone = %d\n",
+				cellhd->proj, cellhd->zone);
+		}
+		if (loc_wind.proj != cellhd->proj) {
+		    strcat(error_msg, "\nERROR: proj\n");
+		}
+		else {
 		    strcat(error_msg, "\nERROR: ");
 		    switch (err) {
 		    case -1:
@@ -186,25 +210,6 @@
 			break;
 		    }
 		}
-		else {
-		    strcat(error_msg, _("Dataset PROJ_INFO is:\n"));
-		    if (cellhd->proj == PROJECTION_XY)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (unreferenced/unknown)\n",
-				cellhd->proj);
-		    else if (cellhd->proj == PROJECTION_LL)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (lat/long)\n",
-				cellhd->proj);
-		    else if (cellhd->proj == PROJECTION_UTM)
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (UTM), zone = %d\n",
-				cellhd->proj, cellhd->zone);
-		    else
-			sprintf(error_msg + strlen(error_msg),
-				"Dataset proj = %d (unknown), zone = %d\n",
-				cellhd->proj, cellhd->zone);
-		}
 	    }
 	    else {
 		/* error in proj_units */
@@ -235,7 +240,7 @@
 		    "the 'location' parameter.\n"));
 
 	    if (check_only)
-		msg_fn = G_message;
+		msg_fn = G_warning;
 	    else
 		msg_fn = G_fatal_error;
 	    msg_fn(error_msg);



More information about the grass-commit mailing list