[Gdal-dev] Re: ECW coordinate system definitions (and other proprietary definition methods)

Frank Warmerdam warmerdam at pobox.com
Thu Aug 26 13:57:55 EDT 2004

Brent Fraser wrote:
> Frank,
>    While doing some work trying to create the coordinate system 
> definitions for MapInfo's TAB file (yuck!), I noticed that some 
> interpretation of ERMapper's ECW coordinate systems has been done about 
> a year ago.  Due to the current path searching setup for GDAL, it will 
> only work if the translation file (ecw_cs.dat) is in 
> "/usr/local/share/gdal" or the current working directory.
>    I made a small change to my local copy of cpl_findfile.cpp to include 
> the place where the PROJ data files are kept (defined by the PROJ_LIB 
> environment variable); at line 74:
>         CPLPushFinderLocation( "." );
>         CPLPushFinderLocation( CPLGetConfigOption("PROJ_LIB","/proj/nad") );
>   But perhaps it should also include the directory of the executable (or 
> a "data" subdir)?  Your thoughts?


The ecw_cs.dat file should be found in the "gdal data" directory.  On unix
this defaults to /usr/local/share/gdal or ${prefix}/share/gdal if you
configure to install elsewhere.   However, you can also override the search
location for GDAL data files with the GDAL_DATA environment variable.
Programmatically the equivelent can be accomplished by calling
CPLSetConfigOptions("GDAL_DATA", "...") or by an appropriate call to
CPLPushFinderLocation() like what you have given.  But I don't particularly
think it is wise to use the PROJ_LIB variable.

We could conceivably try and set GDAL_DATA as ../data relative to the executable.
This would work in "normal" installs as well, but means we need to know where
the executable was from.  This can be arranged in the GDAL utilities but there
is no effort yet to make GDAL using programs report their argv[0].

In short, I think setting GDAL_DATA in the environment is the easiest way of
handling the issue.

NOTE: in various circumstances GDAL and OGR depend on a variety of other
files from the "gdal data" directory.

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    | Geospatial Programmer for Rent

More information about the Gdal-dev mailing list