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).

 

Getting started with C# and GDAL的更多相关文章

  1. GDAL生成Erdas Imagine

    GDAL原生支持超过100种栅格数据类型,涵盖所有主流GIS与RS数据格式,包括•  ArcInfo grids, ArcSDE raster, Imagine, Idrisi, ENVI, GRAS ...

  2. QGis、Gdal本地中文路径问题

    编译qgis完整项目后,由于Gdal库的原因,中文路径下通过添加矢量数据中数据库中是没有OGR的Oracle数据库功能的: 最开始打算通过重新编译gadl库从内部支持中文的(有成功的麻烦也请告诉我), ...

  3. VS2015下编译64位GDAL总结

    使用VS2015编译最新的64位GDAL(最新gdal2.11),确实有一些问题,看来双方还是太新了,有点不兼容,特总结如下. 以前经常用的通过VisualStudio IDE进行编译的方式现在似乎不 ...

  4. VS2010和opencv-2.4.10、GDAL

    系统环境:win10 64位 本文只限于学习交流,商业用途请支持正版! 转载请注明:转载请注明http://www.cnblogs.com/mxbs/p/6206060.html       2016 ...

  5. VS2012配置OpenCV、GDAL开发环境

    VS2012和opencv-2.4.10 第一步:配置之前的准备工作. 完成VS2012的安装,以及opencv-2.4.10的下载和文件提取, 双击此文件,设置文件路径,即可得到提取文件,提取后的文 ...

  6. 编译带有PROJ4和GEOS模块的GDAL

    1.下载三个软件的源代码(去各自官网下载即可) 2.将PROJ4和GEOS的源码放到GDAL目录下的supportlibs文件夹中. 3.修改GDAL的nmake.opt文件,部分内容如下: # Un ...

  7. Java 使用GDAL 读写 shapefile

    读取shp文件,并把它转化为json import org.gdal.ogr.*; import org.gdal.ogr.Driver; import org.gdal.gdal.*; public ...

  8. GDAL C# 开发出现的异常

    在使用开发C#下的GDAL时,编译时正确. 在执行 Gdal.AllRegister(); 出现异常:OSGeo.GDAL.GdalPINVOKE”的类型初始值设定项引发异常. 解决方案: 编译正常, ...

  9. GDAL关于读写图像的简明总结

    读写影像可以说是图像处理最基础的一步.关于使用GDAL读写影像,平时也在网上查了很多资料,就想结合自己的使用心得,做做简单的总结. 在这里写一个例子:裁剪lena图像的某部分内容,将其放入到新创建的. ...

  10. Java maven安装GDAL

    1. 使用编译好的安装jdal http://www.gisinternals.com/release.phpgdal-111-1800-x64-core.msi下载地址:http://downloa ...

随机推荐

  1. 学习 MySQL中导入 导出CSV

    学习 MySQL中导入 导出CSV http://blog.csdn.net/sara_yhl/article/details/6850107    速度是很快的 导出 select * from t ...

  2. json server的简单使用(附:使用nodejs快速搭建本地服务器)

    作为前端开发人员,经常需要模拟后台数据,我们称之为mock.通常的方式为自己搭建一个服务器,返回我们想要的数据.json server 作为工具,因为它足够简单,写少量数据,即可使用. 安装 首先需要 ...

  3. vue中绑定多个class,多个情况使用同一个class时,用js的或 “||”

    class中 当依赖中断的时候是绑定的red,但是这样写绑定不了, 大括号{}里可以下js代码的,下面的orange就可以绑定成功,写成双竖线 形式.

  4. 【git之】fetch和 pull的区别

    Git中从远程的分支获取最新的版本到本地有这样2个命令:1. git fetch:相当于是从远程获取最新版本到本地,不会自动merge Git fetch origin master git log ...

  5. ASP.NET重写Render 加载CSS样式文件和JS文件(切换CSS换皮肤)

    网页换皮肤的方式有很多种,最简单的通常就是切换页面CSS,而CSS通常写在外部CSS文件里.那么切换CSS其实就是更换html里的link href路径.我在网上搜索了下. 一般有两种方式: 1.页面 ...

  6. python列表中的值转换为字符串,及列表里的所有值拼接成一个字符串 的方法

    后记: ls3='%'.join(ls2) 会把%加入拼接成的字符里面,同理,加入其它字符也一样,''空就是什么都不加,如上图 最后输出 1%我%22

  7. 科学-天文学-天文观测站:TMT(红外天文望远镜)

    ylbtech-科学-天文学-天文观测站:TMT(红外天文望远镜) 30米望远镜(Thirty Meter Telescope,TMT) 系由美国加州大学和加州理工学院负责研制的新一代地基巨型光学-红 ...

  8. 点击input触发弹出框的bug

    先点击第一个input建立弹出框,再点击第二个input打开弹出框,操作点击,同时触发了两个input点击事件.主要原因是建立弹出框时绑定了input1的click事件,再次触发时,又再亿次绑定了in ...

  9. SEO优化之“不要轻易使用泛解析”

    原文地址:http://www.chinaz.com/web/2007/0505/8077.shtml 半夜三更的突然想起这个老想提出或者大家都知道的问题! 先续在这里,之后给予全面补充! 什么是泛解 ...

  10. Course List for Student

    题目描述 Zhejiang University has 40000 students and provides 2500 courses. Now given the student name li ...