Compile gdal (version 1.4) in. net

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.