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. java rsa 公钥加密

    注意JAVA 的STRING .getBytes() 默认取的是操作系统的编码,最好统一UTF-8. -- /* * To change this license header, choose Lic ...

  2. Selenium2+python自动化43-判断title(title_is)

    From: https://www.cnblogs.com/yoyoketang/p/6539117.html 前言 获取页面title的方法可以直接用driver.title获取到,然后也可以把获取 ...

  3. 资源 Des加密

    Unity3d资源管理分析 http://blog.csdn.net/sgnyyy/article/details/39268215 打包资源 http://www.cnblogs.com/sifen ...

  4. Foxmail Gmail Outlook

    三个邮件客户端都比较好,但是作为用户精力是非常有限地,必须优中选优. 我选outlook,非常值得拥有. 理由如下: (1)和office完美契合 (2)和生产环境完美契合 (3)免费 (4)良好地任 ...

  5. 使用Google cardboard 2的一些软件

    最近入手cardboard2,FQ尝试了一些软件,特别分享,给大家提供一些方便. 链接:http://pan.baidu.com/s/1slehilZ 密码:b49h

  6. 10分钟复习javaweb

    html:是网页的骨架,静态网页初步的轮廓,简单粗糙,僵硬又没有美感.表单的标签<form>,里面的<input>很常用,里面有type属性等css:为了更加灵活,常与div一 ...

  7. 身高安排方法(基础dfs)

    P1085 时间限制: 0 Sec  内存限制: 128 MB提交: 64  解决: 44[提交][状态][讨论版][命题人:外部导入] 题目描述 Matrix67发现身高接近的人似乎更合得来.Mat ...

  8. Bisecting KMeans (二分K均值)算法讲解及实现

    算法原理 由于传统的KMeans算法的聚类结果易受到初始聚类中心点选择的影响,因此在传统的KMeans算法的基础上进行算法改进,对初始中心点选取比较严格,各中心点的距离较远,这就避免了初始聚类中心会选 ...

  9. 理解Kubernetes(2): 应用的各种访问方式

    理解Kubernetes系列文章: 手工搭建环境 应用的各种访问方式 1. 通过 Pod 的 IP 地址访问应用 1.1 Pod 的IP地址 每个Pod 都会被分配一个IP地址,比如下面这儿pod的I ...

  10. java.util.base64报错解决

    java.util.Base64 这个类,它是在 JDK 1.8 的时候加入的,之前版本的标准库没有这个类. eclipse更换jdk1.8就可以了了.