[gdal-dev] When is GDAL_DATA environment variable read by OGR?

Mateusz Loskot mateusz at loskot.net
Fri Feb 26 14:28:06 EST 2010


Jason Roberts wrote:
> I am curious to know when OGR will read the GDAL_DATA environment 
> variable.

It is set during construction of driver managers of

GDAL

http://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/gdaldrivermanager.cpp?rev=18770#L98

OGR

http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/generic/ogrsfdriverregistrar.cpp?rev=18770#L67

What in practice means, during during first access to any of these two
driver managers. This usually happens when a client calls
either GDALAllRegister

http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/gdalallregister.cpp?rev=18207#L73

or OGRRegisterAll

http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/generic/ogrregisterall.cpp?rev=18449#L38

(GDAL_DATA is shared among GDAL and OGR)

> After looking at the code and reviewing this 
> <http://lists.osgeo.org/pipermail/gdal-dev/2009-May/020584.html> 
> email thread, it appears that the environment variable is currently 
> only read at initialization time 
> (OGRSFDriverRegistrar::OGRSFDriverRegistrar() is one such place), and
>  that changes to the variable after initialization time will not be
> recognized. Is that correct?

AFAIU, yes.

> Do you anticipate that that behavior will change in the future?

I don't know.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org


More information about the gdal-dev mailing list