Using GDAL from C#

Recently Frank Warmerdam and Michael Paul posted some examples on calling GDAL from .NET. This is pretty cool, since this enables you to access a great set of tools that I for one have been accessing by generating batch-files in a .NET application and then running them using the shell-commands (not pretty but it worked :-)

Their posts used several links to pointers and didn't have automatical garbage collection. Since disposing objects is very important when calling unmanaged code, and .NET developers isn't that used to pointers, I decided to wrap some of the GDAL functionaly into a few classes with automatic disposer etc. It still needs some brushing off and to include some more GDAL functionality, but let me know what you think. You can download it here.

Comments (1) -

  • Yes, wouldn't it be nice to have gdal support in .NET... Good to see that there is some progress being made! Anyway, in your example file, you show how to, for instance, save to other formats, such as JPEG. That did not work for me. It gets a handle to the JPEG driver, but in GDAL.Copy hOutDS turns out to be zero when calling the actual GDALCreateCopy. By the way, I have been looking into 3D rendering using DirectX. It looks awesome. So do you know of any similar efforts, perhaps you have also looked into this?

Add comment