GDAL Bindings – How to Install GDAL Bindings for C#/.NET 4.5.1?

cgdalosgeo

I'm trying to use the C# gdal bindings but I get an error in my C# code which says "Unable to load DLL 'gdal_wrap': The specified module could not be found. (Exception from HRESULT: 0x8007007E)".

I've had a look at the dependencies for gdal_csharp.dll and everything looks okay. Two things that stood out though were that the csharp dll is a 32 bit dll, while all the dependencies are for a 64 bit system (my machine has a 64 bit CPU). Also, the file ieshims.dll was listed as a dependency, but from what I gather, it isn't strictly necessary that it be installed.

I've tried installing the files manually via a zip file and also using the .msi installer for the gdal core libraries. I made sure to add the paths to the gdal executables to my system path.

I downloaded the binaries from here:
http://www.gisinternals.com/query.html?content=filelist&file=release-1800-x64-gdal-1-11-1-mapserver-6-4-1.zip

And I roughly followed this guide for installation instructions:
http://vipassanaandenvironmentalinformatics.blogspot.co.nz/2013/03/getting-started-with-c-and-gdal.html

I'm using Visual Studio 2013, for which the binaries are available on the site above.

Best Answer

Get the package from NuGet and then you need to call static methodGdalConfiguration.ConfigureGdal() from GdalConfiguration.cs/vb at startup to set process environmental variables. Call GdalConfiguration.ConfigureOgr() if you want to use OGR as well.

Related Question