Chinaunix首页 | 论坛 | 博客
  • 博客访问: 180160
  • 博文数量: 38
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 372
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-05 19:39
文章分类

全部博文(38)

文章存档

2011年(1)

2010年(2)

2009年(2)

2008年(33)

我的朋友

分类: C/C++

2009-03-01 11:32:00

以前看过一遍,很久不用又忘了。现在将其译过来,便于自己重看时可以快速回忆起来。
ps.英语很烂,仅仅自己看看
*********************************************************************************
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.
这份文档试图描述GDAL的数据模型——GDAL数据存储所包含的信息类型和含义。
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.
Dataset是相关栅格组和其相关信息的集合。Dataset有一个栅格大小的概念专门针对其所有波段,同时也承担着所有波段(bands)地理参考系的转换和坐标系统的定义。dataset也有相关元数据(列表,以string格式存储的名字/值对)。

Note that the GDAL dataset, and raster band data model is loosely based on the OpenGIS Grid Coverages specification.
注意:GDAL的Dataset和栅格波段是和OpenGis 格网覆盖规范 松散相关的。
Coordinate System
Dataset coordinate systems are represented as OpenGIS Well Known Text strings. This can contain:
dataset坐标系统是由OpenGis著名的文本strings表示的,他们可以包含:

    * 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.
    由官方以预定义的坐标系统编写的上述大多数信息的代码,如EPSG投影(The European Petroleum Survey Group,欧洲石油调查组)

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.
对于OpenGIS WKT坐标系统定义的进一步的信息和操纵它们的方法,参考osr_tutorial文档或者OGRSpatisalReference 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().
由GDALDataset::GetProjectionRef()返回的坐标系统描述了暗含在地理参考系的仿射变换的地理坐标系,地理系统的仿射变换由GDALDataset::GetGeoTransform()返回。这个坐标系统通过GDALDataset::GetGCPProjection()返回,其描述了地面控制点地理参考坐标系统。GCPs由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).
GDAL dataset有两种方式去描述栅格位置(以像点坐标)和地理坐标的关系:第一种,也是最常用的一种是用仿射变换,另一种是GCPS(地面控制点)

The affine transform consists of six coefficients returned by GDALDataset::GetGeoTransform() which map pixel/line coordinates into georeferenced space using the following relationship:
仿射变换包含六个系数,这些参数由GDALDataset::GetGeoTransform()返回,其描述了映射像点坐标到地理参考空间的映射,由以下公式计算:

    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.
假设北是向上的影像,GT(2)和GT(4)系数都是0,而GT(1)是像素宽度而GT(5)是想素高,而(GT(0),GT(3)是栅格数据左上角点坐标)

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).
注意:像素坐标是从左上角点的(0.0,0.0)到右下角的(width_in_pixel,height_in_pixel),而左上角点的中心坐标就应当为(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:
一个dataset(资料组)可以有一系列一个或多个位置的控制点以实现栅格到地理坐标的相关。所有的GCPs共享了一个地理参考坐标系统(由GDALDataset::GetProjection()返回),每个控制点(由类GDAL_GCP表示)包含以下内容:

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.
pszId字符串应当是在当前dataset中一套控制点的某控制点的个独一无二的(大多数时候是数值的,但并不绝对)身份标示。pszInfo通常是一个空字符,但是可以包含用户定义与控制点相关的任何的文本。这也使得包含关于控制点状态的固定格式的信息成为一种可能,尽管当前并未实现这一点。

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.
(Pixel,Line)坐标是地面控制点在raster上面的位置,而(X,Y,Z)坐标是关联到地里坐标系统的,通常Z为0。

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.
GDAL数据模型并不包含变换方法,而这些必须通过地面控制点生成...这些留给了应用。然而一阶到五阶多项式都是正常的。

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.
正常地,dataset中将会包含仿射变换或者地面控制点中一个,或者两者都不包含。而两者都包含是不常见的,而且无法判断两者谁更权威。
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).
GDAL元数据是备用格式,运用的是保存为系列名称/值对的特定文本数据。名字需要严格的规范(没有空格和奇怪字符),值可以为任意长度而且可包含任何数字除了嵌入的空值(ASCII null)

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.
元数据处理系统不擅长于处理非常大体积的元数据,处理超过100K的元数据对于一个dataset来说似乎会导致性能(表现)下降。

Over time there will be some well known names defined with established semantics; however, that has not occurred at this time.
随着时间的过去,将会有一些非常著名的名字被以建立的语义学而定义,然而这些现在还没有发生。

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:
一些格式将会支持特定的元数据(用户定义的),而其他的格式驱动将会将会映射特定的格式到元数据名称。比如TIFF驱动将会返回一些信息标签作为元数据,这些元数据包含了时间/数据域,将会以下形式返回:

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.
元数据被分割为命名组称之为域,其缺点在于与没有名字(NULL或者"").一些特别的域为某些特别的原因而存在。注意,当前没有方法去为某个特定目标列举所有的可获得的域,但是程序可以对任意他们知道如何分割的域进行测试。
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的域包含一些列子资料组,一般,这些用于提供指针指向存储在单个多文件的图像的列表(比如,HDF文件或者NITF文件)。比如,一个NITF文件包含四个图像可能有如下子资料组列表。

  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

The value of the _NAME is the string that can be passed to GDALOpen() to access the file. The _DESC value is intended to be a more user friendly string that can be displayed to the user in a selector.
_NAME的值是可被传递给GDAKOpen()连接到文件的string。_DESC值被认为对用户更友好的string,其可以用于以一个选择者显示给用户。
IMAGE_STRUCTURE Domain
Metadata in the default domain is intended to be related to the image, and not particularly related to the way the image is stored on disk. That is, it is suitable for copying with the dataset when it is copied to a new format. Some information of interest is closely tied to a particular file format and storage mechanism. In order to prevent this getting copied along with datasets it is placed in a special domain called IMAGE_STRUCTURE that should not normally be copied to new formats.
元数据在默认域中是和影像相关,而与图像在磁盘上的存储方式并不特别相关。也就是说,当dataset被复制给一个新的格式时,用其复制是适合的。一些有趣的信息是紧密关联在一种特定的文件格式中和存储机理中。为了防止这些有趣信息伴随dataset的复制而复制,它被放置于一个特定的域,称为IMAGE_STRUCTURE,这些不会正常地被复制到一个新的格式中。

One item that appears in the IMAGE_STRUCTURE domain is the compression scheme used for a fromat. The metadata item name is COMPRESSION but the value can be format specific.
出现在IMAGE_STRUCTURE域中的一点是压缩结构被用于一种格式,元数据的条款名是COMPRESSION,但是其值可以是特定格式。

xml: Domains
Any domain name prefixed with "xml:" is not normal name/value metadata. It is a single XML document stored in one big string.
任何域名的前缀是xml的不是正常的名/值形式的元数据,他是单个XML文件,以一个很大的字符串存储。

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中栅格波段用GDALRasterBand类描述,他描述了单个栅格波段/通道/层。他并不需要描述整个影像,比如说,一个24bit的RGB影像一般被描述为3个波段的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.
    宽高 即单行像素数和行数: 如果dataset是一个全分辨率波段,这种描述方法与在dataset中的是相同的。

    * A datatype (GDALDataType). One of Byte, UInt16, Int16, UInt32, Int32, Float32, Float64, and the complex types CInt16, CInt32, CFloat32, and CFloat64.
    数据类型(GDALDataType):包括,Byte UInt16, Int16, Int32,Int32, Float32, Float64和复杂类型CInt16, CInt32, CFloat32,和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.
    一系列名/值对元数据,和dataset种格式相同,但是其信息默认专门指向波段的。

    * 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)
    一个任选的偏移和尺度,以将栅格只能转换为含有意义的值(比如,将高转换为m)

    * 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:
    波段颜色说明,下面就是一个:

          o GCI_Undefined: the default, nothing is known.                                 
           GCI_Undefined: 默认的,颜色信息不知道
          o GCI_GrayIndex: this is an independent grayscale image
           GCI_GrayIndex:灰度图像
          o GCI_PaletteIndex: this raster acts as an index into a color table
           GCI_PaletteIndex: 栅格作为一个颜色表
          o GCI_RedBand: this raster is the red portion of an RGB or RGBA image
           GCI_RedBand: 栅格是RGB影像或者RGBA影像的红色部分
          o GCI_GreenBand: this raster is the green portion of an RGB or RGBA image
           GCI_GreenBand: 栅格是RGB影像或者RGBA影像的绿色部分
          o GCI_BlueBand: this raster is the blue portion of an RGB or RGBA image
           GCI_BlueBand: 栅格是RGB影像或者RGBA影像的蓝色部分
          o GCI_AlphaBand: this raster is the alpha portion of an RGBA image
           GCI_AlphaBand: 栅格是RGBA影像的alpha部分(一般是指透明部分)
          o GCI_HueBand: this raster is the hue of an HLS image
           GCI_HueBand:栅格是HLS图像的色调
          o GCI_SaturationBand: this raster is the saturation of an HLS image
           GCI_SaturationBand:栅格是HLS图像的饱和度
          o GCI_LightnessBand: this raster is the hue of an HLS image
            GCI_LightnessBand:栅格是HLS图像的亮度
          o GCI_CyanBand: this band is the cyan portion of a CMY or CMYK image
            GCI_CyanBand:波段是CMY图像或者CMYK图像的蓝绿色部分
          o GCI_MagentaBand: this band is the magenta portion of a CMY or CMYK image
            GCI_MagentaBand:波段是CMY或CMYK图像的紫红色部分
          o GCI_YellowBand: this band is the yellow portion of a CMY or CMYK image
            GCI_YellowBand:波段是CMY和CMYK波段的黄色部分
          o GCI_BlackBand: this band is the black portion of a CMYK image.
            GCI_BlackBand:波段是CMYK的黑色部分

    * A color table, described in more detail later.
    颜色表,后面将会描述更多细节

    * Knowledge of reduced resolution overviews (pyramids) if available.
    金字塔影像,如果可以获取的话

Color Table
A color table consists of zero or more color entries described in C by the following structure:
颜色表由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 also has a palette interpretation value (GDALPaletteInterp) which is one of the following values, and indicates how the c1/c2/c3/c4 values of a color entry should be interpreted.
颜色表也拥有一个调色板值(GDALPaletteInterp),调色板值是下列值中的一个,用于指示一个颜色实体中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.

To associate a color with a raster pixel, the pixel value is used as a subscript into the color table. That means that the colors are always applied starting at zero and ascending. There is no provision for indicating a prescaling mechanism before looking up in the color table.
将一个颜色和一个栅格像素相关联,像素值将是颜色表的一个索引值。也就是说,颜色总是从0开始逐渐增加的。在检索颜色表前,并没有哪项规定用来指明预定方法。
Overviews
A band may have zero or more overviews. Each overview is represented as a "free standing" GDALRasterBand. The size (in pixels and lines) of the overview will be different than the underlying raster, but the geographic region covered by overviews is the same as the full resolution band.
波段可能有0个或者多个概览,每个概览都描述成独立的GDALRasterBand,概览的尺寸将会与下面的栅格的不同,但是地理上的覆盖却是与全分辨率的波段是相同的。

The overviews are used to display reduced resolution overviews more quickly than could be done by reading all the full resolution data and downsampling.
概览是用于显示金字塔影像的,这样可以显示的速度可以比读取全分辨率数据要快得多。

Bands also have a HasArbitraryOverviews property which is TRUE if the raster can be read at any resolution efficiently but with no distinct overview levels. This applies to some FFT encoded images, or images pulled through gateways (like OGDI) where downsampling can be done efficiently at the remote point.
波段有HasArbitraryOverviews,当影像可以任意分辨率高效地读取但是没有严格的概览等级时,此值为正。这也适用于一些FFT(快速傅里叶变换)编码的影像,或者通过gateway(如,OGID)的影像,这些影像可以在远点(remote point)高效地实现向下采样。

$Id: gdal_datamodel.dox 10112 2006-10-18 13:26:46Z mloskot $

阅读(7823) | 评论(1) | 转发(0) |
0

上一篇:由点到线

下一篇:SVN管理

给主人留下些什么吧!~~

gxsh3182015-04-07 22:42:49

你好,我这段代码,在vs2012中怎么,podataset无法读取内存啊,麻烦指导下,谢谢

TCHAR szfilter[]=_T("图像文件tiff(*.tif)|*.tif|所有文件(*.*)|*.*||");
 CString filepath;
      CFileDialog imageopen(TRUE,_T("我的文件"),_T("*.tif"),
      OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szfilter);
   if(imageopen.DoModal()==IDOK)
   {
    VERIFY (filepath=imageopen.GetFileName());
   }
  
 &