Gdal pairC LanguageAnd Python support has been good until the latestAdd gdal1.4.1The C # language in the. NET environment is supported only when swig is enabled. Coincidentally, I only write C #ProgramAfter querying some of the online experts, I found out how to compile gdal under. net so that it can be used in the C # language.
There are not many related materials on the Internet. I am mainly studying the sharpmap analysis notebook of the. NET 2.0-based open-source GIS project in csdn!
To put it bluntly, several key steps for compiling gdal are as follows:
1 DownloadSource code, Address Http://download.osgeo.org/gdal/gdal-1.4.1.tar.gz
2 Open . Net . Through simple CD Command to find Gdal To decompress the root directory, use Nmake Command to start compilation.
For example:Nmake G: \ project \ gdal141 \ gdal-1.4.1 \ makefile. VC
Compilation takes a long time. Gdal Also 32 MB Surge 300 Multiple MB .
3 , Use CD Command to enter Swig/CSHARP Directory, use again Nmake Command compilation.
For example:Nmake G: \ project \ gdal141 \ gdal-1.4.1 \ swig \ CSHARP \ makefile. VC
Generated after compilation 8 Items DLL File.
They are:Gdal_gdal_csharp.dll, gdal_gdal_wrap.dll, gdal_gdalconst_csharp.dll, gdal_gdalconst_wrap.dll,
Gdal_ogr_csharp.dll, gdal_ogr_wrap.dll, gdal_osr_csharp.dll, gdal_osr_wrap.dll
4 Note: The following is a key step that can be easily ignored: Wrap. dll File Name, remove the previous Gdal _ .
after the name is changed: gdal_gdal_csharp.dll, gdal_wrap.dll, export, gdalconst_wrap.dll,
Gdal_ogr_csharp.dll, ogr_wrap.dll, gdal_osr_csharp.dll, osr_wrap.dll
5 After compilation is completed DLL Copy all to the project directory and copy Four CSHARP. dll As C # ! After compiling according to the above steps, you can use the generated DLL to quickly call a simple example program.