From 9c0cf9ffb967c22697416fa310e6332f07093869 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ra=C3=BAl=20Mar=C3=ADn=20Rodr=C3=ADguez?= Date: Wed, 19 Jun 2019 15:21:29 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.osgeo.org/postgis/trunk@17546 b70326c6-7e19-0410-871a-916f4a2858ee --- libpgcommon/lwgeom_transform.c | 53 ---------------------------------- libpgcommon/lwgeom_transform.h | 1 - postgis/lwgeom_transform.c | 3 -- 3 files changed, 57 deletions(-) diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c index 6e494fadf..7fdc02763 100644 --- a/libpgcommon/lwgeom_transform.c +++ b/libpgcommon/lwgeom_transform.c @@ -92,11 +92,6 @@ static void AddPJHashEntry(MemoryContext mcxt, LWPROJ *projection); 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 @@ DeleteFromPROJSRSCache(PROJPortalCache *PROJCache, int32_t srid_from, int32_t sr } -/** - * 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); diff --git a/libpgcommon/lwgeom_transform.h b/libpgcommon/lwgeom_transform.h index bd9b414c8..951aa801d 100644 --- a/libpgcommon/lwgeom_transform.h +++ b/libpgcommon/lwgeom_transform.h @@ -29,7 +29,6 @@ char *GetProj4String(int32_t srid); */ 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); diff --git a/postgis/lwgeom_transform.c b/postgis/lwgeom_transform.c index 4e75ece7e..02b91b1ee 100644 --- a/postgis/lwgeom_transform.c +++ b/postgis/lwgeom_transform.c @@ -119,9 +119,6 @@ Datum transform_geom(PG_FUNCTION_ARGS) /* 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)); -- 2.49.0