Gdal comprehensive sorting-3: gdal Data Model

Source: Internet
Author: User
Document directory
  • Dataset)
  • Coordinate System
  • Affine geographic Transformation
  • GCPs
  • Metadata (metadata)

On the Internet, I can see that this article is fully written, and it is in Chinese. I just turned around and learned it.
Some of the content is repeated, but it does not affect. Very good information.

Mainly from http://blog.csdn.net/liminlu0314? Viewmode = Contents

When reading the python-gdal documentation, the gdal data model mentioned in it, its URL is http://www.gdal.org/gdal_datamodel.html

Some people have already translated such important documents, so they cannot find them. Record it here for future reference.

--------------------------------------------------------------------------------

This document briefly describes the gdal data model, which can accommodate other information.

Dataset)

A dataset (corresponding to the gdaldataset class) is a set of grating data and information related to it. Specifically, dataset contains the size (pixels, lines, etc.) of the grating data ). Dataset also specifies a coordinate system for the corresponding grating data. Dataset itself can also contain metadata, which are organized in a key/Value Pair mode.

The gdal dataset is defined based on the OpenGIS grid coverages format.

Coordinate System

The dataset coordinate system is defined by the OpenGIS WKT string, which includes:

A global coordinate system name.

A geographic coordinate system name.

A benchmark identifier.

The name of the elliptical body. Semi-majoraxis and inverse flattening ).

Prime meridian and Its offset from Greenwich Mean Meridian.

The type of the projection method (for example, the horizontal axis mokto ).

A list of projection parameters (for example, a central meridian ).

The name of a unit and its conversion parameters to meters and radians.

The name and sequence of the axis.

Encoding in a predefined authoritative coordinate system (for example, epsg ).

For more information, see OpenGIS WKT coordinate system definition, OSR tutorial document, and ogrspatialreference class description document.

In gdal, the function that returns the coordinate system is gdaldataset: getprojectionref (). It returns the coordinate system that describes the geographic reference coordinates, which implies the resolution conversion of the geographical reference, which is returned by gdaldataset: getgeotransform. The coordinate system described by GCPs geographic reference coordinates is returned by gdaldataset: getgcpprojection.

Note: The returned coordinate system string "" indicates an unknown geographic reference coordinate system.

Affine geographic Transformation

A gdal dataset can be used to describe the relationship between a grid location (using a point/line coordinate system) and a geographic reference coordinate system. The first and most common is the use of affine conversion, and the other is GCPs.

Affine transformations are composed of six parameters, which are composed of gdaldataset: getgeotransform (). They return the point/line coordinates and use the following link to film the point/line to the geographical coordinates:

Xgeo = gt (0) + xpixel * gt (1) + yline * gt (2)

Ygeo = gt (3) + xpixel * gt (4) + yline * gt (5)

Assume that the image is in the north, the gt2 and gt4 parameters are 0, while the gt1 parameter is the pixel width, the gt5 parameter is the pixel height, and the (gt0, GT3) point is the upper left corner of the image.

Note that the point/line coordinate system mentioned above is increased from the upper left corner (0, 0) to the lower right corner, that is, the Axis increases from left to right, the increasing coordinate system from top to bottom (that is, the row and column of the image are calculated from the lower left corner ). The center of the point/line position is (0.5, 0.5 ).

GCPs

A dataset can be defined by a series of control points. All GCPs share a geographic reference coordinate system, which is returned by gdaldataset: getgcpprojection. Each GCP (corresponding to the gdal_gcp class) contains the following content:

Typedef struct

{

Char * pszid;

Char * pszinfo;

Double dfgcppixel;

Double dfgcpline;

Double dfgcpx;

Double dfgcpy;

Double dfgcpz;

} Gdal_gcp;

The string pszid is the unique identifier string (usually a number) of the GCP in the dataset ). The string pszinfo is usually empty, but it can also contain some text information defined for GCP. The GCP status may even contain machine analysis information, although currently supported.

The coordinate (dfgcppixel, dfgcpline) is the GCP position in the grid. Coordinates (dfgcpx, dfgcpy, dfgcpz) are the combined geographic reference locations (dfgcpz is usually 0 ).

The gdal data model does not implement the mechanism to change the coordinate system generated by GCPs, but leaves specific operations for users to implement. Generally, the first to fifth order polynomials are commonly used.

Generally, a data set contains an affine geographic transformation, or one or both of GCPs. Both of them are rare and cannot be defined in an authoritative coordinate system.

Metadata (metadata)

Gdal metadata is an auxiliary data format and is presented in key/value pair sequence. Generally, key names are strictly defined (no white space, or some special characters ). The value corresponding to the key can be any length, containing any content (excluding null characters ). A metadata processing system generally cannot process large amounts of data. For example, a data larger than kb may lead to termination of processing.

Although some keys may not exist, they may be defined in the future. Some formatted data supports some basic metadata (which can be defined by the user) and can be accessed using the driver. For example, if the data contains the date/time mark, the driver in TIFF Format may simply return basic information:

Export tag_datetime = 1999: 05: 11 11:29:56

Metadata key/value pairs can also be organized into some domains. The default domain has no name. Of course, special domains may need to be defined to save some special information. At present, although we cannot list all the fields required by an object, the program can test any domain that we already know the exact meaning.

Subdatasets domain

The subdatasets field stores a list of subdatasets. This list usually corresponds to the position of each sub-image in a composite image (such as HDF or nitf ). For example, a nitf consisting of four images may contain a list of child datasets similar to the following:

Subdataset_1_name = nitf_im: 0: multi_1b.ntf

Subdataset_includesc = 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

Values corresponding to keys suffixed with _ name can be passed to gdalopen () for file access. The values of keys suffixed with _ DESC can be displayed to users in a friendly manner.

Image_structure domain

The metadata in the default domain is generally related to the image, but not the specific format of the image. In other words, information unrelated to the image format is also copied when the dataset is copied. To process the data related to the image format, the related key/value pairs are generally placed in the image_structure domain, and the data can not be copied when the dataset is copied.

One item in the image_structure field is the data compression method. The corresponding key name is compression. The corresponding value indicates the compression method.

XML: domain

Any domain prefixed with "XML:" Is not metadata of a common key/value pair. It is a single XML document that is saved as a large string.

Raster band

The grating data of one band corresponds to the gdalrasterband class in gdal. It describes the band, channel, and layer of a single band. It does not describe the entire image at a time. For example, a 24-bit RGB image is generally described as three bands in a dataset, which correspond to three colors of red/green/blue respectively.

Grating data in one band has the following properties:

Number of columns. If sampling is not performed, the value is the same as that defined in dataset.

Data Type (gdaldatatype ). It can be byte, uint16, int16, uint32, int32, float32, float64, or composite type cint16, cint32, cfloat32, or cfloat64.

Block size. This is the size of the suggested buffer. For block-based storage images, it may be the size of a block. For images in the scanning line mode, it may be the size of a scanning line.

The name/Value List in the metadata, which is the same as that in dataset, but may focus more on the features of the current band.

Optional parameter (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 fortransforming raster values into meaning full values (ie translate height tometers)

 

The name of the grating. This feature can be used to specify important data.

Explanation of each band, specifically:

Gci_undefined: Default, unknown information.

Gci_grayindex: An Independent gray image.

Gci_paletteindex: This raster acts as anindex into a color table

Gci_redband: The red band of the RGB or rgba image.

Gci_greenband: green band of the RGB or rgba image.

Gci_blueband: the blue band of the RGB or rgba image.

Gci_alphaband: the alpha channel of the rgba image.

Gci_hueband: HLS image color.

Gci_saturationband: the saturation of the HLS image.

Gci_lightnessband: the light intensity of the HLS image.

Gci_cyanband: cyan band of the cmy or CMYK image.

Gci_magentaband: magenta band of the cmy or CMYK image.

Gci_yellowband: the yellow band of the cmy or CMYK image.

Gci_blackband: The black band of the CMYK image.

A color table that describes more details about the grating data.

Knowledge of specified CED resolution overviews (pyramids) if available.

Color Table

A color table contains 0 or more color structures. Struct is defined as follows:

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 corresponds to a color palette (gdalpaletteinterp). The C1/C2/C3/C4 values in the gdalcolorentry can be used as the color palette index to obtain the true color value.

Gpi_gray: C1 is used as the gray value.

Gpi_rgb: C1/C2/C3 are red/green/blue in sequence, and C4 corresponds to alpha channel.

Gpi_cmyk: C1 is cyan, C2 is magenta, C3 is yellow, C4 is black.

Gpi_hls: C1 is hue, C2 IS lightness, and C3 is saturation.

When represented by a color table, each pixel stores only the position of the pixel color in the color table. The index of each color increases from 0. There is no Scaling Mechanism for the color table.

Summary

A band may have zero or more overviews. each overview is represented as a "free standing" gdalrasterband. thesize (in pixels and lines) of the overview will be different than theunderlying raster, but the geographic region covered by overviews is the sameas
The full resolution band.

The overviews are used to display inclucedresolution overviews more quickly than cocould be done by reading all the fullresolution data and downsampling.

Bands also have a hasarbitraryoverviews property whichis true if the raster can be read at any resolution efficiently but with nodistinct overview levels. this applies to some FFT encoded images, or imagespulled through many ways (like ogdi) Where downsampling
Can be done efficientlyat the remote point

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.