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. WPF Demo12 布局

    1 <Window x:Class="布局.DockPanel1" xmlns="http://schemas.microsoft.com/winfx/2006/x ...

  2. Java内部类的一些注意事项

    背景:最近在做一个项目,为了保证前台风格的统一,前台选用的是GWT框架.GWT通过回调的方式向后台取得数据,在前台展示,因此很多的赋值操作只能在回调函数中通过set方法来实现.我的目的是从后台读取一个 ...

  3. solr4.9+tomcat7 multiCore

    ES不支持groupby,于是想看看solr怎么实现的. 搭建环境: 1)下载tomcat7.solr4.9,解压: 2)配置tomcat7的端口和URIEncoding(utf-8): 3)拷贝so ...

  4. 阿里云ECS安装flannel启动问题

    在阿里云ECS安装flannel,安装过程可以在网上找文章,这样的文章很多.我这里讲一下启动flannel遇到的两个问题的解决方法. 1,network.go:102] failed to retri ...

  5. [转]jvm加载类规则

    jvm包括三种类加载器: 第一种:bootstrap classloader:加载Java的核心类. 第二种:extension classloader:负责加载jre的扩展目录中的jar包. 第三种 ...

  6. PAT 乙级 1009 说反话 (20) C++版

    1009. 说反话 (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 给定一句英语,要求你编写程序,将句中 ...

  7. STP RSTP

    一.透明网桥 1.对于一般的透明网桥来说,通常都具有以下的特点: +拓展LAN的能力 +自主动态学习站点的地址信息 当网桥的某个端口上收到含有某个源MAC地址的数据帧时,它就把该MAC地址和接收该数据 ...

  8. [UE4]单机游戏改网络游戏,不完全清单

    把Actor的复制打开 中腰数据的复制打开,且只在服务器修改(比如角色属性血量) 需要同步的Actor,不在客户端Spawn 客户端的操作,先报告到服务器,服务器再广播到所有客户端 某些逻辑只在服务器 ...

  9. 00014 - linux中用top、ps命令查看进程中的线程

    在Linux上显示某个进程的线程的几种方式. 方法一:PS 在ps命令中,“-T”选项可以开启线程查看.下面的命令列出了由进程号为<pid>的进程创建的所有线程. 1.$ ps -T -p ...

  10. 使用dtc把dtb的反编译为dts

    sudo apt-get install device-tree-compiler dtc -I dtb -O dts msm8976-v1.1-qrd.dtb > msm8976-v1.1-q ...