[gdal-dev] When does the env var GDAL_DATA get processed?

brettwiesner brettwiesner at gmail.com
Tue May 12 18:14:33 EDT 2009


Thanks. That was it.

Tamas Szekeres wrote:
>
>
> 2009/5/7 brettwiesner <brettwiesner at gmail.com 
> <mailto:brettwiesner at gmail.com>>
>
>     Yes that's the error message. It goes on the say somthing about
>     trying to find gcs.csv which is there but since it can't find the
>     env var, it doesn't find the data. This is weird because I set the
>     env var using the win32 function SetEnvironmentVariable() before
>     the call to OGRSpatialReference is made. Since I was setting the
>     variable and getting this message I suspected that GDAL_DATA was
>     being read by something at startup.
>
>
> Hi,
>
> I'm afraid you won't be able to set the environment variable this way. 
> GDAL is using getenv() to retrieve the value which operated on a local 
> copy of the variables created when the process is started. By this 
> means the env variable should be set before the process is spawned.
>  
>  
>
>
>     Is there some code I can write that can tell me what gdal thinks
>     the GDAL_DATA env var is set to?
>
>
> You should instead use SetConfigOption or PushFinderLocation (both 
> exposed to the SWIG API) for this purpose.
>
>
> Best regards,
>
> Tamas
>



More information about the gdal-dev mailing list