在GDAL中栅格数据直接参与各种计算的重要对象是Band

摘录官方描述:

Raster Band

A raster band is represented in GDAL with the GDALRasterBand class. It represents a single raster band/channel/layer. It does not necessarily represent a whole image. For instance, a 24bit RGB image would normally be represented as a dataset with three bands, one for red, one for green and one for blue.

Gdal 中数据以Dataset为基础,具体的栅格数据值被存储在这个Dataset的Band对象之中,一个Dataset可以存储多个Band对象。例如RGB色彩模型的图象,在GDAL的数据模型中被认为是一个拥有3个波段(分别对应R\G\B)的Dataset。

A raster band has the following properties:

  • A width and height in pixels and lines. This is the same as that defined for the dataset, if this is a full resolution band.

    该值在C#中通过Band.XSize, Band.YSize获取

  • A datatype (GDALDataType). One of Byte, UInt16, Int16, UInt32, Int32, Float32, Float64, and the complex types CInt16, CInt32, CFloat32, and CFloat64.

  • A block size. This is a preferred (efficient) access chunk size. For tiled images this will be one tile. For scanline oriented images this will normally be one scanline.

  • A list of name/value pair metadata in the same format as the dataset, but of information that is potentially specific to this band.

    实际上是以String[]方式存储的(这是C/C++程序员的习惯做法),猜测该matadata即是Dataset中获取的metadata内容一致,且不全面。

  • An optional description string.

  • An optional single nodata pixel value (see also NODATA_VALUES metadata on the dataset for multi-band style nodata values).

    在C#中Nodata是对band而言的,理论上如果一个Dataset包含多个Band对象,这些Band对象的Nodata值是不能保证一致的。所以需要分别获取。另外需要注意的一点是,在创建要写入数据的Dataset时,为其Band指定Nodata需要考虑这个数据本身的有效值范围和DataType,设置合适的值。

  • An optional nodata mask band marking pixels as nodata or in some cases transparency as discussed in RFC 15: Band Masks.

  • An optional list of category names (effectively class names in a thematic image).

  • An optional minimum and maximum value.

    该值用于获取Band中数据的最大最小统计值,不过测试了下偶尔会出现统计值不正确的情况,建议自己写方法来处理。

  • An optional offset and scale for transforming raster values into meaning full values (i.e. translate height to meters).

  • An optional raster unit name. For instance, this might indicate linear units for elevation data.

  • A color interpretation for the band. This is one of:

    • GCI_Undefined: the default, nothing is known.
    • GCI_GrayIndex: this is an independent gray-scale image
    • GCI_PaletteIndex: this raster acts as an index into a color table
    • GCI_RedBand: this raster is the red portion of an RGB or RGBA image
    • GCI_GreenBand: this raster is the green portion of an RGB or RGBA image
    • GCI_BlueBand: this raster is the blue portion of an RGB or RGBA image
    • GCI_AlphaBand: this raster is the alpha portion of an RGBA image
    • GCI_HueBand: this raster is the hue of an HLS image
    • GCI_SaturationBand: this raster is the saturation of an HLS image
    • GCI_LightnessBand: this raster is the hue of an HLS image
    • GCI_CyanBand: this band is the cyan portion of a CMY or CMYK image
    • GCI_MagentaBand: this band is the magenta portion of a CMY or CMYK image
    • GCI_YellowBand: this band is the yellow portion of a CMY or CMYK image
    • GCI_BlackBand: this band is the black portion of a CMYK image.
  • A color table, described in more detail later.

  • Knowledge of reduced resolution overviews (pyramids) if available.

其实在真正使用中,比较重要的无非是数据的nodata、xSize、ySize等等,投影等信息由Dataset获取。用于应付一般情况下的简单计算问题不大。

下一篇将详细解释一个常规的数据读取和处理的流程。

【GDAL】聊聊GDAL的数据模型(二)——Band对象的更多相关文章

  1. 【GDAL】聊聊GDAL的数据模型

    GDAL是个非常优秀的GIS数据操作库,最近在和实习生介绍GDAL的简单使用,顺手写下记录 本篇记录栅格数据,代码环境为C# 在GDAL中,栅格数据大致是以一个Dataset对应一个栅格数据文件(.T ...

  2. 【GDAL】GDAL栅格数据结构学习笔记(一): 关于Metadata

    在维护一段代码时看到前任程序员写的获取栅格数据的CellSize的功能,竟然在知道GDAL的情况下去调用AE的接口来解算,觉得费解. 原来的思路是使用AE的Raster对象读取出Raster的文件大小 ...

  3. 聊聊高并发(二十五)解析java.util.concurrent各个组件(七) 理解Semaphore

    前几篇分析了一下AQS的原理和实现.这篇拿Semaphore信号量做样例看看AQS实际是怎样使用的. Semaphore表示了一种能够同一时候有多个线程进入临界区的同步器,它维护了一个状态表示可用的票 ...

  4. 聊聊高并发(二十九)解析java.util.concurrent各个组件(十一) 再看看ReentrantReadWriteLock可重入读-写锁

    上一篇聊聊高并发(二十八)解析java.util.concurrent各个组件(十) 理解ReentrantReadWriteLock可重入读-写锁 讲了可重入读写锁的基本情况和基本的方法,显示了怎样 ...

  5. 深入理解Spring AOP之二代理对象生成

    深入理解Spring AOP之二代理对象生成 spring代理对象 上一篇博客中讲到了Spring的一些基本概念和初步讲了实现方法,当中提到了动态代理技术,包含JDK动态代理技术和Cglib动态代理 ...

  6. Qt对象模型之二:对象树与元对象系统

    一.对象树的概念 Qt中使用对象树(object tree)来组织和管理所有的QObject类及其子类的对象.当创建一个QObject时,如果使用了其他的对象作为其父对象(parent),那么这个 Q ...

  7. 必须要注意的 C++ 动态内存资源管理(二)——指针对象简单实现

    必须要注意的 C++动态内存资源管理(二)——指针对象简单实现 四.拷贝类型的资源         上节我们说过,对于图片类型的资源我们有时候往往采用拷贝(如果对于那种公共图片,可能采用唯一副本,提供 ...

  8. 二.httpRequest-httpResponse-JsonResponse对象

     一.HttpRequest对象 HttpRequest在django.http这个模块中 它是用django创建 文档https://docs.djangoproject.com/en/1.11/r ...

  9. 聊聊高并发(二十)解析java.util.concurrent各个组件(二) 12个原子变量相关类

    这篇说说java.util.concurrent.atomic包里的类,总共12个.网上有非常多文章解析这几个类.这里挑些重点说说. watermark/2/text/aHR0cDovL2Jsb2cu ...

随机推荐

  1. ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.

    在做多表映射查询时,在同一个resultMap中写了1:1映射和1:n映射,结果测试时报错如下: org.apache.ibatis.exceptions.PersistenceException: ...

  2. 硬核!如何模拟 5w+ 的并发用户?

    来自:http://t.cn/ES7KBkW 本文将从负载测试的角度,描述了做一次流畅的5万用户并发测试需要做的事情. 你可以在本文的结尾部分看到讨论的记录. 快速的步骤概要 编写你的脚本 使用JMe ...

  3. nginx 499错误

    原因: 服务响应时间太长,客户端自动断开链接. 解决: 1. 找到响应世间长的接口,看依赖的数据源(数据库,第三方接口等)响应时间是否超时,还是自己程序有逻辑问题. 可以通过加入日志打印时间消耗来确定 ...

  4. Mock接口数据 = mock服务 + iptable配置

    一.mock接口数据应用场景: 1.测试接口A,A接口代码中调用其他服务的B接口,由于开发排期.测试环境不通等原因,依赖接口不可用 2.测试异常情况,依赖接口B返回的数据格式不对.返回None.超时等 ...

  5. HNUSTOJ-1696 简单验证码识别(模拟)

    1696: 简单验证码识别 时间限制: 2 Sec  内存限制: 128 MB 提交: 148  解决: 44 [提交][状态][讨论版] 题目描述 验证码是Web系统中一种防止暴力破解的重要手段.其 ...

  6. (四:NIO系列) Java NIO Selector

    出处:Java NIO Selector 1.1. Selector入门 1.1.1. Selector的和Channel的关系 Java NIO的核心组件包括: (1)Channel(通道) (2) ...

  7. 深入浅出Oracle数据读取一致性和事务表

    保证Oracle数据库读取一致性的关键是SCN.每一个数据块头都会记录一个事务提交的SCN.同时每一数据块头都包含一个事务表(ITL),事务必须获得一个ITL事务表才能进行数据修改.该事务表用来确定当 ...

  8. spark浅谈(2):SPARK核心编程

    一.SPARK-CORE 1.spark核心模块是整个项目的基础.提供了分布式的任务分发,调度以及基本的IO功能,Spark使用基础的数据结构,叫做RDD(弹性分布式数据集),是一个逻辑的数据分区的集 ...

  9. node.js从入门到放弃《模块》

    在计算机程序的开发过程中,随着程序代码越写越多,在一个文件里代码就会越来越长,越来越不容易维护. 为了编写可维护的代码,我们把很多函数分组,分别放到不同的文件里,这样,每个文件包含的代码就相对较少,很 ...

  10. Linux忘记root密码解决方案

    忘记Linux root密码时,只需重启Linux系统,然后引导进入Linux的单用户模式(init 1),由于单用户模式不需要输入登陆密码,因此,可直接登陆系统,修改root密码即可解决问题.需要说 ...