大赵传奇

援引事类,扬搉古今,举要删芜,言辩而理切--QQ276605216

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Getting started with C# and GDAL

http://vipassanaandenvironmentalinformatics.blogspot.jp/2013/03/getting-started-with-c-and-gdal.html

转自。

http://www.gisremotesensing.com/2017/01/code-snippet-create-new-field-in-shape.html

http://www.gisremotesensing.com/2015/10/read-esri-file-gdodatabase-filegdb.html

http://www.gisremotesensing.com/2015/09/read-raster-block-by-block-using-gdal.html

http://www.gisremotesensing.com/2015/09/read-raster-file-into-array-using-c-and.html

http://www.gisremotesensing.com/2016/12/esri-featureclass-vs-feature-layer.html

http://www.gisremotesensing.com/2015/10/enable-esri-arcgis-extension-licence.html

http://www.gisremotesensing.com/2015/09/feature-to-raster-conversion-using-c.html

http://www.gisremotesensing.com/2015/09/vector-to-raster-conversion-using-gdal-c.html

http://www.gisremotesensing.com/2015/07/building-arcmaps-add-in-using-command.html

http://www.gisremotesensing.com/2015/09/vector-to-raster-conversion-using-gdal-c.html

 

 

 

The Geospatial Data Abstraction Library (GDAL) is great if you want to process raster data, especially regarding format conversion. I want to use GDAL for a biodiversity modelling project, so I had a look at the C#-bindings of GDAL. The described steps work both with VS 2010 as well as VS 2012, what you need to do is:
  • Download the latest version of the precompiled GDAL binaries from here. Choose the ones that suit your system (32bit or 64bit). Extract the contents from the zip file to a location on your hard disk e.g. C:\Program Files\GDAL (I ran into a number of AccessViolationExceptions when I used the binaries from FWTools 2.4.7).
  • Include both the path to C:\Program Files\GDAL\bin\gdal\csharp as well as C:\Program Files\GDAL\bin in your PATH system variable.
 
Setting of the PATH variable
Creating a Console Application (VS 2010)
 
  • Add four of.the dll-files that can can be found at C:\Program Files\GDAL\bin\gdal\csharp (or wherever your installation path of the current binaries is) to your project references: gdal_csharp.dllgdalconst_csharp.dll,ogr_csharp.dll and osr_csharp.
 
Adding necessary references (VS 2010)
 
  • Build the solution. If you are on a 64bit system and you are using the 64bit GDAL binaries you have to make sure you actually build for 64bit (you will get errors otherwise when you try to run the program).
Setting of the platform target for 64bit (VS 2012)
  • Now you can run the program with some data. Include a reference to one of the raster files in the Command line arguments field of your Debug options (in the properties of your GDALInfo project; don't forget to put the path inside double quotes of it includes blanks).
 
  • Run the program (Ctrl-F5). It should show you something similar to the following:
Output of GDALInfo
That's it. Now you can use the other example C#-programs to open, copy, manipulate raster data in variety of file formats. For some of the other example files it is necessary to add some additional references (e.g. System.Drawing).
 
posted on 2017-02-15 17:04  赵长青  阅读(464)  评论(0编辑  收藏  举报