Hi Ari, See inline:
brettwiesner kirjoitti:
Hi,

I have an application that programatically sets the GDAL_DATA environment variable. However, when I do this I get errors complaining that it can't find GDAL_DATA. When I use an application like process explorer to see the environment of the process I see that I am correctly setting the environment variable to what I want. If I run the application from a batch file that "sets" the env var before running the application then things work.

Because I can see from process explorer that I'm correctly setting the env var for the process, I am left to believe that some dll get's loaded and the GDAL_DATA env var is used before my code gets a chance to set it. Is this possible? When/ where does the value of the env var GDAL_DATA get used?

Does the error message you get specifically mention GDAL_DATA? I.e., does it contain "...Try setting the GDAL_DATA environment variable..."? I believe that's the only error message which refers to GDAL_DATA and it's called from OGRSpatialReference::importFromEPSGA in ogr_fromepsg.cpp. That method "Initialize SRS based on EPSG GCS or PCS code." (from docs). It shoudn't be called in an initialization of a DLL.

GDAL_DATA is used often when GDAL needs to find files, but if GDAL_DATA is not found there's no complaints.
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.

Is there some code I can write that can tell me what gdal thinks the GDAL_DATA env var is set to?

Thanks,
Brett
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to