Browse Source

g.proj: special case if georef is a .proj file, as in gdalsrsinfo

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74074 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 6 years ago
parent
commit
148d111d08
1 changed files with 12 additions and 3 deletions
  1. 12 3
      general/g.proj/input.c

+ 12 - 3
general/g.proj/input.c

@@ -281,10 +281,19 @@ int input_georef(char *geofile)
 	    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);
+	    }
 	}
     }