资源描述
GDAL Data Model
即描述一个GDAL data store能够包括的信息的类型。
Dataset
一个dataset (即一个GDALDataset 对象)是一组有关的raster bands和某些属于它们的公共信息的集合。尤其是dataset有一个适合用于它所有bands的有关raster size的概念,它是用pixels 和 lines来描述的。这个dataset也负责它所有bands的地理参考的转换和坐标系统的定义。Dataset自身也可有有关的metadata,即以string形式的一张name/values pairs的列表。
注意:GDAL dataset和raster band 的数据模型是基于 the OpenGIS Grid
Coverages specification的。
Coordinate System
Dataset的坐标系统是按OpenGIS WKT(Well known Text)的方式来描述的。它包括:
* An overall coordinate system name .
一个总的坐标系的名称。
* A geographic coordinate system name.
一个地理坐标系统的名称。
* A datum identifier.
大地参考系。
* An ellipsoid name, semi-major axis, and inverse flattening.
参考椭球体,椭球半长轴和。椭球扁率的导数(即a/(a-b))
* A prime meridian name and offset from Greenwich.
一个0度经线的名车以及它于本初子午线的偏离程度。
* A projection method type (ie. Transverse Merctator).
一个投影类型。
* A list of projection parameters (ie. central_meridian ).
一个投影参数的列表。
* A units name , and conversion factor to meters or radians.
一个单位名称以及转化为米或者弧度的转化因子。
* Names and ordering for the axes .
轴的名称和排序。
* Codes for most of the above in terms of predefined coordinate systems from authorities such as EPSG.
按照预先定义的权威的坐标系统对上面的大多数信息进行编码。
要想获取更多的有关OpenGIS WKT 格式的坐标系统的定义,以及使用它们的方式,能够参考osr_tutorial 文档和OGRSpatialReference 类的文档(OGR库中)。
由GDALDataset::GetProjectionRef() 返回的坐标系统描述的是通过仿射几何变换所得的地理坐标参考系,该变换由GDALDateset::GetGeoTransform()所得。
由GDALDataset::GetGCPProjection()返回的坐标系统描述的是带控制点的地理参考坐标系,控制点由GDALDateset::GetGCPs()得到。
注意:一个返回的带“”的坐标系字符串没有指出任何有关地理参考坐标系统的东西。
Affine GeoTransform
GDAL datasets 有两种方式描述raster 位置(用 pixel/line 坐标)与地理参考坐标之间的关系。首先,最常用的是the affine transform(the other is GCPS)。
The affine transform 包括由 GDALDataset::GetGeoTransform()的六个系数。
如把pixel/line coordinate 转化成 georeferenced space 使用如下关系:
Xgeo = GT(0) + Xpixel * GT(1) + Yline * GT(2)
Ygeo = GT(3) + Xpixel * GT(4) + Yline * GT(5)
在正北朝上的影像中,系数GT(2)与GT(4)都为0,GT(1)是pixel width,
GT(5)是pixel height。(GT(0),GT(3))是raster的左上角pixel的左上角位置。
注意:the pixel/line coordinate 上起左上像素的左上角(0.0,0.0),下至右下像素的右下角(width_in_pixels,height_in_pixels)。这么左上像素的中间的pixel/line 位置就是(0.5,0.5)。
GCPS
一个dataset能够有一个与从raster到georeferenced coordinates的一个或多个位置有关的控制点的集合。所有的 GCPS 共同拥有一个地理参考坐标系统(由GDALDataset::GetGCPProjection()返回)。每一个GCP由一个GDAL_GCP对象表示,它如下定义:
typedef struct
{
char *pszId ;
char *pszInfo ;
double dfGCPPixel ;
double dfGCPLine ;
double dfGCPX ;
double dfGCPY ;
double dfGCPZ ;
} GDAL_GCP ;
pszId字符串被期望是这个dataset里所有GCPS集合里对应每个GCP的唯一标识(常常是但并不总是数字)。
pszInfo一般是一个空字符串,不过它能够包括任何用户定义的与GCP有关的文本。潜在的它也能包括机器中有关GCP状态的信息尽管目前还不行。
第三、四个组员是GCP在rster中的位置,后三个是有关的地理参考位置(其中Z常常为0)。
GDAL数据模型并没暗示GCPS必须产生的转化机制,这个留给详细的应用程序,可是从第一到第五个多项式是常见的。
一般地一个dataset将包括一个affine geotransform或GCPS或二者都不包括。两个都有的情况并不常见,哪一个方式更权威并没有明确定义。
Metadata
GDAL元数据是一个保存为一组name/value pairs列表的辅助格式和应用程序特殊的文本数据。The names 要求有良好的表示行为(没有间隔或单个的字符串)。
而the values能够是任何长度以及包括任何东西除了内嵌NULL(ASCIIzero)值。
元素据处理系统并不能很好的处理大容量的元素据。为一个dataset处理超出100K的元素据将很也许导致性能的降级。
伴随时间的推移,将会有某些以建立的语义所定义的知名的names;可是目前还没有。
有某些格式将支持一般的(用户自定义的)元素据,而其他某些格式的驱动将把明确的格式属性映射到元数据的names中。例如the TIFF 的驱动就以元数据的方式返回了某些信息标识,包括日期/时间的属性如下面这种形式返回:
TIFFTAG_DATETIME = 1999:05:11 11:29:56
元素据被切提成称做域的指定的组,缺省的域没有名字(NULL或“”)。某些特殊的域为某些特殊的目标而存在。
注意:目前无法对一个给定的对象列举出所有可用的域,不过应用程序能够对它们懂得怎样解释的任何域进行测试。
SUBDATASETS Domain
The SUBDATASETS域保存了一份子datasets的列表。一般这被用来提供指针指向单张多影像文献所存储的影像列表(例如HDF或NITF)。例如,一个含有四张images的NITF也许有如下的subdataset list.
SUBDATASET_1_NAME=NITF_IM:0:multi_1b.ntf
SUBDATASET_1_DESC=Image 1 of multi_1b.ntf
SUBDATASET_2_NAME=NITF_IM:1:multi_1b.ntf
SUBDATASET_2_DESC=Image 2 of multi_1b.ntf
SUBDATASET_3_NAME=NITF_IM:2:multi_1b.ntf
SUBDATASET_3_DESC=Image 3 of multi_1b.ntf
SUBDATASET_4_NAME=NITF_IM:3:multi_1b.ntf
SUBDATASET_4_DESC=Image 4 of multi_1b.ntf
SUBDATASET_5_NAME=NITF_IM:4:multi_1b.ntf
SUBDATASET_5_DESC=Image 5 of multi_1b.ntf
_NAME的值是能够被传给GDALOpen()访问那个文献的字符串。_DESC的值被用作为能够在一个选择器中显示给用户的更友好的字符串。
IMAGE_STRCTURE Domain
缺省域中的元数据与影像有关,不过并不尤其的与影像存储在磁盘上的方式有关。也就是说,当dataset被复制成另一个格式时它是适合的。某些感兴趣的信息与特定的文献格式和存储机制有紧密联系。为了预防它们伴随数据集一起被复制,它们被存储在一个叫做IMAGE_STRCTURE的特殊的域,这个域将不会正常的被复制到一中新的格式中。
出目前IMAGE_STRCTURE域中的一个条目就是用于这种格式的压缩的配备(OR摘要信息)。这个元素据条目名称是COMPRESSION,不过其值对不一样的格式是不一样的。
xml:Domains 任何以xml为前缀名的域都不是一般的name/value元素据。它只是存储为一个长字符串的XML文档。
Raster Band 一个raster band在GDAL中是用一个GDALRasterBand对象表示的。它代表一个单独的raster band/channel/layer.它无须要表示整个影像。例如,1张24位的RGB影像将一般被表示为一个具备3个bands的datasets,分别表示红,绿,蓝。
一个raster band有如下属性:
* 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.
* 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.
* An optional description string.
* An optional list of category names (effectively class names in a thematic image).
* An optional minimum and maximum value.
* An optional offset and scale for transforming raster values into meaning full values (ie 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. (如:GCI_Undefined,GCI_Blueband等)。
* A color table, described in more detail later.
* Knowledge of reduced resolution overviews (pyramids) if available.
Color Table
一个color table 由0或更多的用C描述的颜色条目组成,如下的结构:
typedef struct
{
/- gray, red, cyan or hue -/
short c1;
/- green, magenta, or lightness -/
short c2;
/- blue, yellow, or saturation -/
short c3;
/- alpha or blackband -/
short c4;
} GDALColorEntry;
The color table 也有一个调色板的解译值(GDALPaletteInterp),是下列值的一个,并且指出了对应的一个color entry的c1/c2/c3/c4值。
· GPI_Gray: Use c1 as grayscale value.
· GPI_RGB: Use c1 as red, c2 as green, c3 as blue and c4 as alpha.
· GPI_CMYK: Use c1 as cyan, c2 as magenta, c3 as yellow and c4 as black.
· GPI_HLS: Use c1 as hue, c2 as lightness, and c3 as saturation.
使一个color与一个raster pixer联系起来,像素值被写在下方的在一个color table里。这意味着the colors 一般从0开始逐渐上升。在从color table查找之前没有一个指示项引百分比因子的要求。
Overviews
一个band也许有一个或更多的overviews。每一个overviews被体现成一个”free standing”GDALRasterBand。The overview的size(in pixels and lines)将于潜在的raster不一样,不过overviews所覆盖的地理区域与the full resolution band相同。
The overviews被用来更快的显示减少辨别率的overviews,相对于读所有的全色波段的数据。
Bands也有一个HasArbitratyOverviews属性,它是TRUE表示raster能在任何辨别率下有效的阅读而没有不一样的overview级别。这个被用于某些FFT编码的影像,or images pulled through gateways (like OGDI) where downsampling can be done efficiently at the remote point.(最后一段没弄懂!)
原文
· Main Page
· Related Pages
· Classes
· Files
GDAL Data Model
This document attempts to describe the GDAL data model. That is the types of information that a GDAL data store can contain, and their semantics.
Dataset
A dataset (represented by the GDALDataset class) is an assembly of related raster bands and some information common to them all. In particular the dataset has a concept of the raster size (in pixels and lines) that applies to all the bands. The dataset is also responsible for the georeferencing transform and coordinate system definition of all bands. The dataset itself can also have associated metadata, a list of name/value pairs in string form.
Note that the GDAL dataset, and raster band data model is loosely based on the OpenGIS Grid Coverages specification.
Coordinate System
Dataset coordinate systems are represented as OpenGIS Well Known Text strings. This can contain:
· An overall coordinate system name.
· A geographic coordinate system name.
· A datum identifier.
· An ellipsoid name, semi-major axis, and inverse flattening.
· A prime meridian name and offset from Greenwich.
· A projection method type (ie. Transverse Mercator).
· A list of projection parameters (ie. central_meridian).
· A units name, and conversion factor to meters or radians.
· Names and ordering for the axes.
· Codes for most of the above in terms of predefined coordinate systems from authorities such as EPSG.
For more information on OpenGIS WKT coordinate system definitions, and mechanisms to manipulate them, refer to the osr_tutorial document and/or the OGRSpatialReference class documentation.
The coordinate system returned by GDALDataset::GetProjectionRef() describes the georeferenced coordinates implied by the affine georeferencing transform returned by GDALDataset::GetGeoTransform(). The coordinate system returned by GDALDataset::GetGCPProjection() describes the georeferenced coordinates of the GCPs returned by GDALDataset::GetGCPs().
Note that a returned coordinate system strings of "" indicates nothing is known about the georeferencing coordinate system.
Affine GeoTransform
GDAL datasets have two ways of describing the relationship between raster positions (in pixel/line coordinates) and georeferenced coordinates. The first, and most commonly used is the affine transform (the other is GCPs).
The affine transform consists of six coefficients returned by GDALDataset::GetGeoTransform() which map pixel/line coordinates into georeferenced space using the following relationship:
Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2)
Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5)
In case of north up images, the GT(2) and GT(4) coefficients are zero, and the GT(1) is pixel width, and GT(5) is pixel height. The (GT(0),GT(3)) position is the top left corner of the top left pixel of the raster.
Note that the pixel/line coordinates in the above are from (0.0,0.0) at the top left corner of the top left pixel to (width_in_pixels,height_in_pixels) at the bottom right corner of the bottom right pixel. The pixel/line location of the center of the top left pixel would therefore be (0.5,0.5).
GCPs
A dataset can have a set of control points relating one or more positions on the raster to georeferenced coordinates. All GCPs share a georeferencing coordinate system (returned by GDALDataset::GetGCPProjection()). Each GCP (represented as the GDAL_GCP class) contains the following:
typedef struct
{
char *pszId;
char *pszInfo;
double dfGCPPixel;
double dfGCPLine;
double dfGCPX;
double dfGCPY;
double dfGCPZ;
} GDAL_GCP;
The pszId string is intended to be a unique (and often, but not always numerical) identifier for the GCP within the set of GCPs on this dataset. The pszInfo is usually an empty string, but can contain any user defined text associated with the GCP. Potentially this can also contain machine parsable information on GCP status though that isn't done at this time.
The (Pixel,Line) position is the GCP location on the raster. The (X,Y,Z) position is the associated georeferenced location with the Z often being zero.
The GDAL data model does not imply a transformation mechanism that must be generated from the GCPs ... this is left to the application. However 1st to 5th order polynomials are common.
Normally a dataset will contain either an affine geotransform, GCPs or neither. It is uncommon to have both, and it is undefined which is authoritative.
Metadata
GDAL metadata is auxiliary format and application specific textual data kept as a list of name/value pairs. The names are required to be well behaved tokens (no spaces, or odd characters). The values can be of any length, and contain anything except an embedded null (ASCII zero).
The metadata handling system is not well tuned to handling very large bodies of metadata. Handling of more than 100K of metadata for a dataset is likely to lead to performance degradation.
Some formats will support generic (user defined) metadata, while other format drivers will map specific format fields to metadata names. For instance the TIFF driver returns a few information tags as metadata including the date/time field which is returned as:
TIFFTAG_DATETIME=1999:05:11 11:29:56
Metadata is split into named groups called domains, with the default domain having no name (NULL or ""). Some specific domains exist for special purposes. Note that currently there is no way to enumerate all the domains available for a given object, but applications can "test" for any domains they know how to interprete.
The following metadata items have well defined semantics in the default domain:
· AREA_OR_POINT: May be either "Area" (the default) or "Point". Indicates whether a pixel value should be assumed to represent a sampling over the region of the pixel or a point sample at the center of the pixel. This is not intended to influence interpretation of georeferencing which remains area oriented.
· NODATA_VALUES: The value is a list of space separated pixel values matching the number of bands in the dataset that can be collectively used to identify pixels that are nodata in the dataset. With this style of nodata a pixel is considered nodata in all bands if and only if all bands match the corresponding value in the NODATA_VALUES tuple. This metadata is not widely honoured by GDAL drivers, algorithms or utilities at this time.
· MATRIX_REPRESENTATION: This value, used for Polarimetric SAR datasets, contains the matrix representation that this data is provided in. The following are acceptable values:
o SCATTERING
o SYMMETRIZED_SCATTERING
o COVARIANCE
o SYMMETRIZED_COVARIANCE
o COHERENCY
o SYMMETRIZED_COHERENCY
o KENNAUGH
o SYMMETRIZED_KENNAUGH
· POLARMETRIC_INTERP: This metadata item is defined for Raster Bands for polarimetric SAR data. This indicates which entry in the specified matrix representation of the data this band represents. For a dataset provided as a scattering matrix, for example, acceptable values for this metadata item are HH, HV, VH, VV. When the dataset is a covariance matrix, for example, this metadata item will be one of Covariance_11, Covariance_22, Covariance_33, Covariance_12, Covariance_13, Covariance_23 (since the matrix itself is a hermitian matrix, that is all the data that is required to describe the matrix).
SUBDATASETS Domain
The SUBDATASETS domain holds a list of child datasets. Normally this is used to provide pointers to a list of images stored within a single multi image file (such as HDF or NITF). For instance, an NITF with four images might have the following subdataset list.
SUBDATASET_1_NAME=NITF_IM:0:multi_1b.ntf
SUBDATASET_1_DESC=Image 1 of multi_1b.ntf
SUBDATASET_2_NAME=NITF_IM:1:multi_1b.ntf
SUBDATASET_2_DESC=Image 2 of multi_1b.ntf
SUBDATASET_3_NAME=NITF_IM:2:multi_1b.ntf
SUBDATASET_3_DESC=Image 3 of multi_1b.ntf
SUBDATASET_4_NAME=NITF_IM:3:multi_1b.ntf
SUBDATASET_4_DESC=Image 4 of multi_1b.ntf
SUBDATASET_5_NAME=NIT
展开阅读全文