[postgis-tickets] r17546 - PROJ: Remove manual call to proj_context_set_search_paths

Raul raul at rmr.ninja
Wed Jun 19 08:21:29 PDT 2019


Author: algunenano
Date: 2019-06-19 08:21:29 -0700 (Wed, 19 Jun 2019)
New Revision: 17546

Modified:
   trunk/libpgcommon/lwgeom_transform.c
   trunk/libpgcommon/lwgeom_transform.h
   trunk/postgis/lwgeom_transform.c
Log:
PROJ: Remove manual call to proj_context_set_search_paths

AFAIK, we don't provide PROJ files inside our postgis installation
anymore and this is conflicting with PROJ6, as changing the
search path makes it unable to find the proj.db in the
default PATH.



Modified: trunk/libpgcommon/lwgeom_transform.c
===================================================================
--- trunk/libpgcommon/lwgeom_transform.c	2019-06-19 15:19:31 UTC (rev 17545)
+++ trunk/libpgcommon/lwgeom_transform.c	2019-06-19 15:21:29 UTC (rev 17546)
@@ -92,11 +92,6 @@
 static LWPROJ *AddToPROJSRSCache(PROJPortalCache *PROJCache, int32_t srid_from, int32_t srid_to);
 static void DeleteFromPROJSRSCache(PROJPortalCache *PROJCache, int32_t srid_from, int32_t srid_to);
 
-/* Search path for PROJ.4 library */
-static bool IsPROJLibPathSet = false;
-void SetPROJLibPath(void);
-
-
 /*
 * Given a function call context, figure out what namespace the
 * function is being called from, and copy that into a global
@@ -781,59 +776,11 @@
 }
 
 
-/**
- * Specify an alternate directory for the PROJ.4 grid files
- * (this should augment the PROJ.4 compile-time path)
- *
- * It's main purpose is to allow Win32 PROJ.4 installations
- * to find a set grid shift files, although other platforms
- * may find this useful too.
- *
- * Note that we currently ignore this on PostgreSQL < 8.0
- * since the method of determining the current installation
- * path are different on older PostgreSQL versions.
- */
-void SetPROJLibPath(void)
-{
-	char *path;
-	char *share_path;
-	const char **proj_lib_path;
-
-	if (!IsPROJLibPathSet) {
-
-		/*
-		 * Get the sharepath and append /contrib/postgis/proj to form a suitable
-		 * directory in which to store the grid shift files
-		 */
-		proj_lib_path = palloc(sizeof(char *));
-
-		share_path = palloc(MAXPGPATH);
-		get_share_path(my_exec_path, share_path);
-
-		path = palloc(MAXPGPATH);
-		*proj_lib_path = path;
-
-		snprintf(path, MAXPGPATH - 1, "%s/contrib/postgis-%s.%s/proj", share_path, POSTGIS_MAJOR_VERSION, POSTGIS_MINOR_VERSION);
-#if POSTGIS_PROJ_VERSION < 60
-		/* Set the search path for PROJ.4 */
-		pj_set_searchpath(1, proj_lib_path);
-#else
-		/* Set the search path for PROJ */
-		proj_context_set_search_paths(NULL, 1, proj_lib_path);
-#endif
-		/* Ensure we only do this once... */
-		IsPROJLibPathSet = true;
-	}
-}
-
 int
 GetPJUsingFCInfo(FunctionCallInfo fcinfo, int32_t srid_from, int32_t srid_to, LWPROJ **pj)
 {
 	PROJPortalCache *proj_cache = NULL;
 
-	/* Set the search path if we haven't already */
-	SetPROJLibPath();
-
 	/* Look up the spatial_ref_sys schema if we haven't already */
 	SetSpatialRefSysSchema(fcinfo);
 

Modified: trunk/libpgcommon/lwgeom_transform.h
===================================================================
--- trunk/libpgcommon/lwgeom_transform.h	2019-06-19 15:19:31 UTC (rev 17545)
+++ trunk/libpgcommon/lwgeom_transform.h	2019-06-19 15:21:29 UTC (rev 17546)
@@ -29,7 +29,6 @@
  */
 typedef void *ProjCache ;
 
-void SetPROJLibPath(void);
 bool IsInPROJCache(ProjCache cache, int32_t srid_from, int32_t srid_to);
 PJ *GetPJFromPROJCache(ProjCache cache, int32_t srid_from, int32_t srid_to);
 int GetPJUsingFCInfo(FunctionCallInfo fcinfo, int32_t srid_from, int32_t srid_to, LWPROJ **pj);

Modified: trunk/postgis/lwgeom_transform.c
===================================================================
--- trunk/postgis/lwgeom_transform.c	2019-06-19 15:19:31 UTC (rev 17545)
+++ trunk/postgis/lwgeom_transform.c	2019-06-19 15:21:29 UTC (rev 17546)
@@ -119,9 +119,6 @@
 	/* Take a copy, since we will be altering the coordinates */
 	gser = PG_GETARG_GSERIALIZED_P_COPY(0);
 
-	/* Set the search path if we haven't already */
-	SetPROJLibPath();
-
 	/* Convert from text to cstring for libproj */
 	input_srs = text_to_cstring(PG_GETARG_TEXT_P(1));
 	output_srs = text_to_cstring(PG_GETARG_TEXT_P(2));



More information about the postgis-tickets mailing list