[Proj] value of PROJ_LIB variable

Frank Warmerdam warmerdam at pobox.com
Fri May 5 09:52:18 EDT 2006

Erich Sadlowski wrote:
> Hello,
> I'm using the libproj.a in my application.
> When "feeding" the pj_init_plus with an "+init=epsg:xxxxx" definition I get a
> problem: the epsg file could'nt be found. When debugging the code I detect that
> in pj_open_lib a getenv("PROJ_LIB") is made ... and I'm surprised to see that it
> has a value although at the system prompt an echo $PROJ_LIB results in an empty
> string. So: Where is this environment variable set??


I am not aware of anywhere in PROJ.4 that sets this enviroment variable. But
PROJ.4 does have a few methods of finding the support files beside this
environment variable.

A default build on Unix-like systems will define the PROJ_LIB macro to be the
default install directory in pj_open_lib.c.  This is often

You can also use the pj_set_finder() and pj_set_searchpath() functions
programatically to override how the files are found.

I would guess that in your case it is the PROJ_LIB *macro* that is getting

> It seems to me that the value of it is the path where the project originally was
> compiled an published (on our server). Unfortunately this directory is moved to
> an other place (where at least I bind the libproj.a from).
> Can anybody explain this behaviour?

Normally when you are building your own application that will "knows" about
it's environment, such as where it's support files are placed, it would
use pj_set_finder() or pj_set_searchpath() to tell PROJ where to find them.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org

More information about the Proj mailing list