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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Mar 7 09:44:52 PST 2019


Author: mmetz
Date: 2019-03-07 09:44:52 -0800 (Thu, 07 Mar 2019)
New Revision: 74178

Modified:
   grass/trunk/general/g.proj/main.c
Log:
g.proj: need GRASS_PROJSHARE to list codes with PROJ 4

Modified: grass/trunk/general/g.proj/main.c
===================================================================
--- grass/trunk/general/g.proj/main.c	2019-03-07 17:33:34 UTC (rev 74177)
+++ grass/trunk/general/g.proj/main.c	2019-03-07 17:44:52 UTC (rev 74178)
@@ -310,16 +310,19 @@
 
 #else
 	/* PROJ 4 */
-	projCtx ctx;
+	/* can't use pj_find_file() from the old proj api
+	 * because it does not exist in PROJ 4 */
+	char *grass_proj_share;
 	
 	authname = listcodes->answer;
 	if (G_strcasecmp(authname, "EPSG") == 0)
 	    authname = "epsg";
 
-	ctx = pj_ctx_alloc();
-	if (!pj_find_file(ctx, authname, pathname, GPATH_MAX))
-	    G_fatal_error(_("Unable to find init file %s"), authname);
-	pj_ctx_free(ctx);
+	grass_proj_share = getenv("GRASS_PROJSHARE");
+	if (!grass_proj_share)
+	    G_fatal_error(_("Environment variable GRASS_PROJSHARE is not set"));
+	sprintf(pathname, "%s/%s", grass_proj_share, authname);
+	G_convert_dirseps_to_host(pathname);
 #endif
 
 	/* PROJ 4 / 5 */



More information about the grass-commit mailing list