3

I'm intrigued by what I see with DotSpatial, mainly for its C# interface with GDAL. I've downloaded the source (and the 3.5 x86 package) and I'm a bit stuck with using the GDALHelper class to initialize the GDAL library.

(I think it should be just a call to GDALHelper.Configure() but I'm hitting errors when I do that.)

I figure that's probably going to be the first of many questions with the DotSpatial, and was wondering if there are any good open-source projects (applications) that use it so that I could see how it's set up in practice.

2
  • can you post the errors.
    – Nathan W
    Commented Apr 7, 2011 at 22:49
  • @Nathan W: I'm very sorry. The errors weren't with AllRegister(). That changes my question a bit, I guess.
    – John
    Commented Apr 8, 2011 at 17:48

1 Answer 1

3

Not sure there are many projects out there that use it other than MapWindow - who are also the creators of DotSpatial.

If you look at the source for the GDALHelper class, you can see exactly why errors are thrown:

var driverPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

if (driverPath == null) throw new GdalException("Cannot get the executing assemblies location");

Gdal.SetConfigOption("GDAL_DRIVER_PATH", Path.Combine(driverPath, "gdalplugins"));

Gdal.SetConfigOption("GDAL_DATA", Path.Combine(driverPath, "gdal-data"));

var systemPath = Environment.GetEnvironmentVariable("PATH");

if (systemPath == null) throw new GdalException("Cannot get the environment path variable");

Are any of these the errors you encounter? It looks like it needs all the GDAL DLLs in subfolders of the DotSpatial project, and also needs to access the PATH Windows environment variable.

If you already have another version of GDAL that could cause problems.

2
  • Thanks for this answer. I'll check it tomorrow at work.
    – John
    Commented Apr 8, 2011 at 7:29
  • I added a comment above. I made a mistake as to where the errors were from. But you answer is helpful in that it leads me to MapWindow. Thanks!
    – John
    Commented Apr 8, 2011 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.