C# bindings

The GDAL project (primarily Tamas Szekeres) maintains SWIG generated C# bindings for GDAL and OGR.

Generally speaking the classes and methods mostly match those of the GDAL and OGR C++ classes, but there is currently no C# specific documentation beyond this site.

The C# bindings are also usable from other .NET languages, such as VB.Net.

The C# interface has been built upon the same libraries as the other SWIG generated wrappers (like Perl, Python, Java, PHP and Ruby). Therefore, the class names, class member names, and the method signatures are driven by the GDAL+SWIG conventions and might not follow the conventional .NET naming guidelines. However, one can easily identify the matching members in the GDAL/OGR API documentation.

The GDAL/OGR C# classes use the .NET P/Invoke mechanism for the communication between the managed and unmanaged code. Every class implements the IDisposable interface to control the finalization of the underlying unmanaged memory referenced by every the wrapper class.

Supported platforms

Currently the interface is compilable on and supports:

  • the various Win32 and Win64 platforms targeting the Microsoft.NET and the MONO frameworks,

  • GNU Linux/OSX systems using the MONO framework, and

  • Unity systems on Windows, OSX and Linux (currently only the MONO framework and not IL2CPP).

Getting GDAL for C#

There are a number of ways to get the C# bindings, including but not limited to:

  • The gisinternals site, see below under “Windows Build SDK”,

  • The Conda package, see instructions below

  • The gdal.netcore NuGet package, see link below, and

  • For Unity, there is a UPM package that installs GDAL, available from here (available on Windows, Mac and Linux)

(all of these are community supported)

Windows Build SDKs

Tamas Szekeres maintains build SDK packages in order to compile GDAL from the sources on Windows. The build system provides daily build binary packages for the latest stable and development versions.