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. oracle数据库使用小结

    select * from r_patient a where a.birthdate= to_date('1953-03-01','yyyy-mm-dd');select * from r_pati ...

  2. LeetCode——7. Reverse Integer

    一.题目链接:https://leetcode.com/problems/reverse-integer/ 二.题目大意: 给定一个整数,要求反转该整数之后再返回:如果归返回的整数超过了int型整数的 ...

  3. Office 2016 Pro Plus \ Project 专业版 \ Visio 专业版 \ 64 位vol版本方便KMS小马oem

    在使用上,零售版和批量授权版并没有区别,只是授权方式方面的区别,相对而言,VOL 版的更容易激活一些,其他并没有什么区别了. 有需要的可以在下面下载:(以下均是 64位VL 版) 版本:Office ...

  4. C语言中的补码与反码(-1的十六进制ffffffff)

    我们先举个例子 1个字节的数字7用二进制表示为  0000 0111,最高位为0(0为正数,1为负数) 反码是将正数的所有位都取反,包括最高位 而负数的二进制表示为补码(反码加1),反码只是过渡阶段 ...

  5. 延时队列:Java中的DelayQueue

    Java中的DelayQueue位于java.util.concurrent包下,本质是由PriorityQueue和BlockingQueue实现的阻塞优先级队列. 放入队列的元素需要实现java. ...

  6. VLAN原理

    体系结构(分层次): 更好的细化结构,能够更清楚的分析数据在整个转发过程中的变化过程.尽可能的把功能独立分开,放到不同层次上. 物理上的拓扑结构:总线型/环形/星形 逻辑上的拓扑:星形总线 OSI七层 ...

  7. 项目中自己一直用到的baseAdapter的类

    import java.util.LinkedList; import java.util.List; import android.content.Context; import android.v ...

  8. [UE4]蓝图调试小心得

    假设某个功能由10个蓝图步骤组成,在第10步的某个蓝图函数的其中一个参数为none,可以使用not equal(Object)和Print从第10步开始,一步一步倒退到第一步检查,看看是哪一个步骤参数 ...

  9. tf.nn.dynamic_rnn

    tf.nn.dynamic_rnn(cell,inputs,sequence_length=None, initial_state=None,dtype=None, parallel_iteratio ...

  10. 获取SQL数据库表空间结构

    if exists(select 1 from tempdb..sysobjects where id=object_id('tempdb..#tabName') and xtype='u')drop ...