[postgis-users] PROJ_LIB environment variable

Regina Obe lr at pcorp.us
Thu Nov 18 20:08:56 PST 2021

Regarding the environment variables, I think if you define it during the
service install process, whatever variables are defined locally will
override the global ones.  I think that is how installation of PostgreSQL
sets up different postgresql bin/lib paths as you can see in the installed


Another way to do it is just run them under different service accounts and
have the env variables defined at the user level for that account instead of
system.  I think user variables override the system ones  if they are
defined in both places.

As part of packaging I do try to keep all the dependencies the same of
PostGIS for all versions of PostgreSQL at least for same PostGIS version to
minimize on these issues. So as long as you are running the same version of
PostGIS on all versions of PostgreSQL you should be fine.





From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf
Of Wisse J.S. (Jeroen)
Sent: Thursday, November 18, 2021 8:37 AM
To: 'PostGIS Users Discussion' <postgis-users at lists.osgeo.org>
Subject: Re: [postgis-users] PROJ_LIB environment variable


Thank you for your help Regina,

Wouldn't your solution just override the environmental variable?


Anyway I just looked into it further and it seems to be a non-issue for us.

I compared the 2 different PROJ_LIB directories and they are exactly the
same. All the files in there are exactly the same as well.


So it doesn't matter where the variable points to.


Thanks again for the help,



Van: postgis-users <postgis-users-bounces at lists.osgeo.org
<mailto:postgis-users-bounces at lists.osgeo.org> > Namens Regina Obe
Verzonden: donderdag 18 november 2021 14:15
Aan: 'PostGIS Users Discussion' <postgis-users at lists.osgeo.org
<mailto:postgis-users at lists.osgeo.org> >
Onderwerp: Re: [postgis-users] PROJ_LIB environment variable


One note I think if you set the variables before PostgreSQL is installed as
a service it will set it on use.


Take a look at C:\Program Files\PostgreSQL\14\pg_env.bat


I've never tried it before though, but it's my understanding it reads that
file during installation. And registration of the service.  So I suspect if
you edit that file adding the PROJ_LIB path and then reinstall or manually
register the service it should work.


For my testing I have a script that has all these envs in it and then starts
up PostgreSQL so I can easily control which version of everything I am


Hope that helps,



From: Regina Obe [mailto:lr at pcorp.us] 
Sent: Thursday, November 18, 2021 8:06 AM
To: 'PostGIS Users Discussion' <postgis-users at lists.osgeo.org
<mailto:postgis-users at lists.osgeo.org> >
Subject: RE: [postgis-users] PROJ_LIB environment variable




From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf
Of Wisse J.S. (Jeroen)
Sent: Wednesday, November 17, 2021 8:45 AM
To: 'postgis-users at lists.osgeo.org' <postgis-users at lists.osgeo.org
<mailto:postgis-users at lists.osgeo.org> >
Subject: [postgis-users] PROJ_LIB environment variable




We have a server that has multiple versions of PostgreSQL installed.

Some of these PostgreSQL installations use the PostGIS extension.
Unfortunately these PostGIS extensions are all different versions.


When using the windows installer for PostGIS some environment variables are
set. Some can have the same value for each PostGIS installation. But there
are 2 that refer to a specific directory.

These are:


-       GDAL_DATA: which also can be set in the postgresql.conf file as

-       PROJ_LIB


My question is, is it possible to set the PROJ_LIB variable somewhere else
then as an environment variable?



Kind regards,


Jeroen Wisse

[Regina Obe] 

Not to my knowledge, but I'd be happy to be proven wrong.

That said which versions of proj are you using? It should only be used for
Pro > 6


Pre-Proj 6.0 this setting wasn't important and I never used it. PostGIS
always looked for all it needed in the contrib/postgis*/proj  folder

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20211118/0063e760/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 19295 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20211118/0063e760/attachment.jpg>

More information about the postgis-users mailing list