wiki:WCS+interoperability

Version 8 (modified by Ari Jolma, 6 years ago) ( diff )

--

WCS Basics and GDAL

WCS is designed for serving potentially multidimensional (2D surface of the earth, depth, elevation, time) complex data (multiple measurements from a single point or area). The server needs to describe both the coordinate system and the internal organization of the data, and also its extent and magnitude respectively. The coordinate system is described as axis names and reference systems. The extent of the data in the coordinate system is given as an envelope. The internal organization (relationship between axes of data and coordinate system axes) is described with a sequence rule, which is by default linear and increasing in the order of the coordinate axes but the order and whether data is arranged first to last or last to first along the axis can be changed.

The data is further tied to the coordinate system with starting point of data, location of the origin of the data in the coordinate system, and with offset vectors. The starting point of data is by default the first data point. The offset vectors give coefficients for converting data point locations into coordinates. The offset vectors are in the order defined by the sequence rule. The magnitude of the data is given as an envelope, which gives the number of data points along each data axis.

The situation is much complicated by the fact that coordinate systems defined for the surface of the earth can be set up in many ways. It is common to have the first axis to point east but it is possible to have it pointing north. Also the data can organized internally for computer in many ways. GDAL traditionally calls the organization sequences of pixels that form lines, which form sequences of lines. In GDAL the first data point is assumed to be at the location of (0,0) in the pixel,line coordinates, and that the pixel,line coordinates increase linearly. GDAL also traditionally associates pixels with X axis of the coordinate system and lines with Y axis of the coordinate system. GDAL uses the concept of a GeoTransform to tie the data points to the coordinate system. The GDAL GeoTransform defines the minimum or maximum of the X and Y coordinates associated with the first data point (it assumes the data point represents a rectangular area with the point in the center; whether the values are minimum or maximum depends on the signs of the first and third coefficient), and the coefficients (above offset vectors) for computing the X,Y coordinates for any data point (again, the min/max X,Y coordinates associated with it).

GDAL usually expects the coordinate system to be such that X increases eastward and Y increases northward. (I'm not sure about this. "usually" is also not a good word in computing. I think Even mentioned something like this in an email some time ago.). GDAL has functions to detect the cases where coordinate systems differ from the GDAL concept of first axis east, second axis north. When such coordinate systems are detected in WCS, the order of all things related to the two axes is swapped. This means axis labels, and coordinate values among other things. The swapping happens in all communication, that is, when parsing a response from a server and when constructing a request.

to write: what happens if the internal organization of data that is served over WCS is not according to what GDAL assumes (data axis order, sequence)

to write: WCS servers may allow asking data in CRS that is not the CRS the coverage is described. If GDAL sets the CRS of the dataset into that CRS, it needs to set its GeoTransform and raster size accordingly. That requires projection transformation.

WCS Best Practices for Interoperability

This page is created for gathering best practices about how to use WCS so that it 1) is standard compliant 2) helps with achieving interoperability between different implementations.

Related mailing list threads:

https://lists.osgeo.org/pipermail/gdal-dev/2017-April/046366.html

https://lists.osgeo.org/pipermail/gdal-dev/2017-November/047650.html

Test data

Sample image A from the WCS KISS dataset

WCS KISS test image A

Sample image B from the WCS KISS dataset

WCS KISS test image B

Image A is an exact SUBSET of image B

Images are of type "pixel is area". The pixel centers show in this image

WCS KISS test image A with pixel centers

Extents of the test images

1) In first case the raster images are somewhere in Chine where the longitude is greater than 90. Polygons which contain completely all the pixels are in the PostGIS EWKT format:

Image A: SRID:4326;POLYGON (( 115 30, 115 33, 117 33, 117 30, 115 30 ))

Image B: SRID:4326;POLYGON (( 114 29, 114 34, 118 34, 118 29, 114 29 ))

Image A has width=2 and height=3 and it can be constructed from an array: [Red,Red,Green,Green,Blue,Blue]

Image B has width=4 and height=5 and can be constructed from an array: [Grey,Grey,Grey,Grey,Grey,Red,Red,Grey,Grey,Green,Green,Grey,Grey,Blue,Blue,Grey,Grey,Grey,Grey,Grey]

A.tfw

1

0

0

-1

115.5

32.5

B.tfw

1

0

0

-1

114.5

33.5

Attachments (8)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.