GDAL Exceptions in C # development

Source: Internet
Author: User

When using gdal under development C #, the compile-time is correct.

In the execution

Gdal.allregister ();

An exception occurred: the type initializer for OSGeo.GDAL.GdalPINVOKE "throws an error.

  

Solution:

Compile correctly, indicating that the Gdal main eight dynamic library DLLs have been added correctly.

GDAL_CSHARP.DLL,GDAL_WRAP.DLL,GDALCONST_CSHARP,GDALCONST_WRAP.DLL,OGR_CSHARP.DLL,OGR_WRAP.DLL,OSR_, respectively. Csharp.dll,osr_wrap.dll.

The _csharp.dll with tail is the file that the C # project needs to reference, and the band _wrap.dll needs to be placed directly in the execution directory.

The reason for the compilation error is that some other DLLs are missing.

GDAL C # DLL Download:

http://www.gisinternals.com/sdk/

On the URL above, click Stable Releases

  

You can click into the appropriate interface according to the version you are using. For example, the use of Win32.

  

Click to download,release-1800-gdal-1-11-4-mapserver-6-4-3.zip

After unpacking, open the Bin folder, there are n DLLs, copy these DLLs to the execution directory of the project (these DLLs also include the above eight DLLs, recommended replacement). Copy only the DLL for the Bin folder, not the other folders.

  

In addition, you can download Release-1800-gdal-1-11-4-mapserver-6-4-3-src.zip, which has the relevant source code, to conduct a deeper study.

GDAL Exceptions in C # development

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.