标签:
在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:
A color table, described in more detail later.
Knowledge of reduced resolution overviews (pyramids) if available.
其实在真正使用中,比较重要的无非是数据的nodata、xSize、ySize等等,投影等信息由Dataset获取。用于应付一般情况下的简单计算问题不大。
下一篇将详细解释一个常规的数据读取和处理的流程。
标签:
原文地址:http://www.cnblogs.com/DannielZhang/p/5183761.html