Exception while using GDAL in C#

后端 未结 8 511
囚心锁ツ
囚心锁ツ 2020-12-11 02:35

I started to use gdal_csharp dll in my application and read a geotiff file. but it says:

The type initializer for \'OSGeo.GDAL.GdalPINVOKE\'         


        
相关标签:
8条回答
  • 2020-12-11 03:00

    Have you added the path to your GDAL libraries to your PATH environment variable? I downloaded my files from http://vbkto.dyndns.org/sdk/?_sm_au_=iVVqjsHS2n46WP00 and here's my path: C:\libs\release-1600-gdal-1-9-mapserver-6-2\bin.

    0 讨论(0)
  • 2020-12-11 03:01

    To use the C#-bindings of GDAL you need an installation of FWTools (from http://fwtools.maptools.org/) as well as the most current binaries that match your system (from http://vbkto.dyndns.org/sdk/). Afterwards it is important to include the bin-directory of FWTools (example for 64bit-systems: C:\Program Files (x86)\FWTools2.4.7\bin) in your PATH variable as well as the necessary dlls (gdal_csharp.dll was mentioned in the question) in your Visual Studio project references. I outlined the complete processs here.

    This process works on 32 bit as well as 64 bit systems, I tested it with VS 2010 and 2012.

    0 讨论(0)
提交回复
热议问题