[GRASS-SVN] r71595 - grass/trunk/vector/v.external

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 25 11:56:51 PDT 2017


Author: mmetz
Date: 2017-10-25 11:56:51 -0700 (Wed, 25 Oct 2017)
New Revision: 71595

Modified:
   grass/trunk/vector/v.external/proj.c
Log:
v.external: bug fixes for location creation and error reporting

Modified: grass/trunk/vector/v.external/proj.c
===================================================================
--- grass/trunk/vector/v.external/proj.c	2017-10-25 18:33:30 UTC (rev 71594)
+++ grass/trunk/vector/v.external/proj.c	2017-10-25 18:56:51 UTC (rev 71595)
@@ -19,7 +19,6 @@
     Ogr_projection = NULL;
     *proj_info = NULL;
     *proj_units = NULL;
-    G_get_window(cellhd);
 
     /* Fetch input layer projection in GRASS form. */
 #if GDAL_VERSION_NUM >= 1110000
@@ -243,6 +242,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:
@@ -280,25 +303,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 */
@@ -329,11 +333,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) {
+		ds_close(hDS);
 		exit(EXIT_FAILURE);
 	    }
 	}



More information about the grass-commit mailing list