[GRASS-SVN] r74074 - grass/trunk/general/g.proj

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 10 06:29:20 PST 2019


Author: mmetz
Date: 2019-02-10 06:29:20 -0800 (Sun, 10 Feb 2019)
New Revision: 74074

Modified:
   grass/trunk/general/g.proj/input.c
Log:
g.proj: special case if georef is a .proj file, as in gdalsrsinfo

Modified: grass/trunk/general/g.proj/input.c
===================================================================
--- grass/trunk/general/g.proj/input.c	2019-02-09 21:45:58 UTC (rev 74073)
+++ grass/trunk/general/g.proj/input.c	2019-02-10 14:29:20 UTC (rev 74074)
@@ -281,10 +281,19 @@
 	    hSRS = OSRNewSpatialReference(wktstring);
 	}
 	else {
-	    G_warning(_("Unable to read georeferenced file <%s> using "
-			"GDAL library, trying to open it as ESRI WKT"), geofile);
+	    int namelen;
 
-	    return input_wkt(geofile);
+	    namelen = strlen(geofile);
+	    if (namelen > 4 && G_strcasecmp(geofile + (namelen - 4), ".prj") == 0) {
+		G_warning(_("<%s> is not a GDAL dataset, trying to open it as ESRI WKT"),
+			  geofile);
+
+		return input_wkt(geofile);
+	    }
+	    else {
+		G_fatal_error(_("Unable to read georeferenced file <%s> using "
+				"GDAL library"), geofile);
+	    }
 	}
     }
 



More information about the grass-commit mailing list