[Gdal-dev] Re: Problem using EPSG in C#

Tomas R monshi at home.se
Wed May 9 03:24:32 EDT 2007


Frank Warmerdam skrev:
> Tomas R wrote:
>> What I guess I miss is how to set up the paths and so between/to the 
>> different data files.
>> GDAL is located in FWTools\bin (on the PATH)
>> EPSG-catalouge in FWTools\Data (also on the PATH) and also copied to 
>> the  VSE project.
>> But how SHOULD it be? I stumble in darkness...
> 
> Tomas,
> 
> I think what you need to do is call Gdal.PushFinderLocation()
> with the path to the GDAL data directory as the argument.
> 
> When applications are run from within the FWTools Shell this is
> accomplished via an environment variable (GDAL_DATA), but freestanding
> applications can call CPLPushFinderLocation() which in the csharp
> bindings is (I believe) known as Gdal.PushFinderLocation().
> 
> Best regards,
To perhaps make things a bit clearer:
I use GDAL for C# found in the distribution with FWTools. It works like 
a charm when using WKT-strings for setting up the SpatialReferences, as 
long as I get the strings correct. My environment is WinXP and Visual 
Studio Express 2005.

I have a small stand-alone test application where I check how GDAL works 
and try new ways to do things. This one compiles to a single executable. 
When I try the EPSG-codes they work if I copy the data-files (all the 
csv and others) to the root of the project in VSE. When compiled this 
gives that the data-files are in the same folder as the executable and 
the depending C#-DLLs.
But I can't make it work if the data-files are on any other location, on 
any other path!
I try with
GDAL.gdal.SetConfigOption("GDAL_DATA",@"C:\Program\FWTools1.2.2\data\");
and
GDAL.gdal.PushFinderLocation(@"C:\Program\FWTools1.2.2\data\");
but no success. Is the paths badly formed? Are more paths needed?

The goal is to use the EPSG-method in my main-application, a dll which 
is plugged in to another software. There I can't get it work in anyway, 
I have tried the same approach of copying the data-files to no luck.

What do I miss? How do I properly set up the path to the data-files? Do 
I miss some initialization command? Can I query GDAL and check the setup 
or the available data-files?

Yours
Tomas




More information about the Gdal-dev mailing list