【GDAL】聊聊GDAL的数据模型(二)——Band对象
在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对象的更多相关文章
- 【GDAL】聊聊GDAL的数据模型
GDAL是个非常优秀的GIS数据操作库,最近在和实习生介绍GDAL的简单使用,顺手写下记录 本篇记录栅格数据,代码环境为C# 在GDAL中,栅格数据大致是以一个Dataset对应一个栅格数据文件(.T ...
- 【GDAL】GDAL栅格数据结构学习笔记(一): 关于Metadata
在维护一段代码时看到前任程序员写的获取栅格数据的CellSize的功能,竟然在知道GDAL的情况下去调用AE的接口来解算,觉得费解. 原来的思路是使用AE的Raster对象读取出Raster的文件大小 ...
- 聊聊高并发(二十五)解析java.util.concurrent各个组件(七) 理解Semaphore
前几篇分析了一下AQS的原理和实现.这篇拿Semaphore信号量做样例看看AQS实际是怎样使用的. Semaphore表示了一种能够同一时候有多个线程进入临界区的同步器,它维护了一个状态表示可用的票 ...
- 聊聊高并发(二十九)解析java.util.concurrent各个组件(十一) 再看看ReentrantReadWriteLock可重入读-写锁
上一篇聊聊高并发(二十八)解析java.util.concurrent各个组件(十) 理解ReentrantReadWriteLock可重入读-写锁 讲了可重入读写锁的基本情况和基本的方法,显示了怎样 ...
- 深入理解Spring AOP之二代理对象生成
深入理解Spring AOP之二代理对象生成 spring代理对象 上一篇博客中讲到了Spring的一些基本概念和初步讲了实现方法,当中提到了动态代理技术,包含JDK动态代理技术和Cglib动态代理 ...
- Qt对象模型之二:对象树与元对象系统
一.对象树的概念 Qt中使用对象树(object tree)来组织和管理所有的QObject类及其子类的对象.当创建一个QObject时,如果使用了其他的对象作为其父对象(parent),那么这个 Q ...
- 必须要注意的 C++ 动态内存资源管理(二)——指针对象简单实现
必须要注意的 C++动态内存资源管理(二)——指针对象简单实现 四.拷贝类型的资源 上节我们说过,对于图片类型的资源我们有时候往往采用拷贝(如果对于那种公共图片,可能采用唯一副本,提供 ...
- 二.httpRequest-httpResponse-JsonResponse对象
一.HttpRequest对象 HttpRequest在django.http这个模块中 它是用django创建 文档https://docs.djangoproject.com/en/1.11/r ...
- 聊聊高并发(二十)解析java.util.concurrent各个组件(二) 12个原子变量相关类
这篇说说java.util.concurrent.atomic包里的类,总共12个.网上有非常多文章解析这几个类.这里挑些重点说说. watermark/2/text/aHR0cDovL2Jsb2cu ...
随机推荐
- linux中常用的60个命令及作用详解
Linux 必学的 60 个命令 Linux 提供了大量的命令,利用它可以有效地完成大量的工作,如磁盘操作.文件存取.目录操作.进程管理.文件权限设定等.所以,在 Linux 系统上工作离不开使用系统 ...
- Java-集合第一篇认识Java集合
1.4种集合类型 List:有序可重复集合. Queue:队列集合. Set:无序不可重复集合. ------------------------------- Map:关系映射集合. 2.所有的集合 ...
- js Object的属性 Configurable,Enumerable,Writable,Value,Getter,Setter
对象的数据属性 Configurable,Enumerable,Writable,Value var person = {} Object.defineProperty(person,'name',{ ...
- [BZOJ2588]Count on a tree(LCA+主席树)
题面 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始为0,即第一个询问 ...
- python 更快地判断数字的奇数还是偶数
使用 按位与运算符(&) 将能更加快速地判断一个整数是奇数还是偶数 使用举例如下: def check_number(n): if n & 1: return '奇数' else: r ...
- django 中 slice 和 truncatewords 不同用法???
django中取一段字符串中的前 N 个字符,可以用 slice和truncatewords ,但是两者是有区别的. django的 模板过滤器 truncatewords ,取这个模板变量的前 N ...
- P1522 牛的旅行 (Floyd)
[题目描述] 请编程找出一条连接两个不同牧场的路径,使得连上这条路径后,这个更大的新牧场有最小的直径.输出在所有牧场中最小的可能的直径. [题目链接] https://www.luogu.org/pr ...
- 一些关于C#发送邮件的代码
1.命名空间 using System.Net.Mail; 2.创建一个MailMessage类的对象 MailMessage mail = new MailMessage(); MailMessag ...
- 解析安装mysql
大多数人在结束咱们前面学习的基础知识的时候,其实一脸懵逼,不过我们已经开始步入了另一个新的高度,针对基础知识还是必须巩固针对性的进行补充,可以分模块总结:比如基础知识的数据结构---->函数-- ...
- Reference与ReferenceQueue
Reference源码分析 首先我们先看一下Reference类的注释: /** * Abstract base class for reference objects. This class def ...