Browse Source

Fix GPJ__get_datum_params() to respect https://trac.osgeo.org/grass/changeset/69211 (see https://trac.osgeo.org/grass/ticket/2456)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@69494 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 8 years ago
parent
commit
e543b66dc9
1 changed files with 11 additions and 5 deletions
  1. 11 5
      lib/proj/datum.c

+ 11 - 5
lib/proj/datum.c

@@ -189,11 +189,17 @@ int GPJ__get_datum_params(const struct Key_Value *projinfo,
 	returnval = 2;
     }
     else if (G_find_key_value("nadgrids", projinfo) != NULL) {
-	const char *gisbase = G_gisbase();
-
-	G_asprintf(params, "nadgrids=%s%s/%s", gisbase, GRIDDIR,
-		   G_find_key_value("nadgrids", projinfo));
-	returnval = 2;
+        const char *projshare = getenv("GRASS_PROJSHARE");
+
+        if (!projshare) {
+            G_warning(_("Failed to detect nadgrids path, GRASS_PROJSHARE not defined"));
+            returnval = -1;
+        }
+        else {
+            G_asprintf(params, "nadgrids=%s%c%s", projshare, HOST_DIRSEP,
+                       G_find_key_value("nadgrids", projinfo));
+            returnval = 2;
+        }
     }
     else if (G_find_key_value("towgs84", projinfo) != NULL) {
 	G_asprintf(params, "towgs84=%s",