geopackage

Go back

Tiled Gridded Coverage Data

The “GeoPackage Extension for Tiled Gridded Coverage Data” extension (previously titled Elevation Extension) defines how to encode and store tiled regular gridded data, such as a digital elevation model, in a GeoPackage. The tiles contain values, such as elevation, temperature or pressure, and are stored in one of two encodings:

gpkg_extensions

To use this extension, add the following rows to this table.

table_name column_name extension_name definition scope
gpkg_2d_gridded_coverage_ancillary NULL gpkg_2d_gridded_coverage http://docs.opengeospatial.org/is/17-066r1/17-066r1.html read-write
gpkg_2d_gridded_tile_ancillary NULL gpkg_2d_gridded_coverage http://docs.opengeospatial.org/is/17-066r1/17-066r1.html read-write
tile pyramid user data table name tile_data gpkg_2d_gridded_coverage http://docs.opengeospatial.org/is/17-066r1/17-066r1.html read-write

gpkg_contents

Like any other content type, add a row for each coverage, using a data_type of “2d-gridded-coverage”.

gpkg_spatial_ref_sys

Like any other content type, the SRS for your contents must be registered in this table. Much like GeoPackage provides a default SRS (EPSG::4326) for normal use, when this extension is in use, EPSG::4979 (WGS-84 with height above ellipsoid) is provided as a default. However, any valid SRS may be used.

gpkg_2d_gridded_coverage_ancillary

Add a row to this table for each coverage.

Column Value
id primary key
tile_matrix_set_name tile pyramid user data table name
datatype “integer” or “float”
scale* Scale as a multiple relative to the unit of measure (Default 1)
offset* The offset to the 0 value (Default 0)
precision The smallest value that has meaning for this dataset
data_null The value that indicates NULL
grid_cell_encoding “grid-value-is-center” (default), “grid-value-is-area”, or “grid-value-is-corner”
uom Units of Measure for values in the grid coverage (see UCUM)
field_name Type of Gridded coverage data (default is “Height”)
quantity_definition Description of the values contained in the gridded overage (default is “Height”)

* Only used for “integer” datatype

gpkg_2d_gridded_tile_ancillary

Add a row to this table for each tile for each coverage.

Column Value
id primary key
tpudt_name tile pyramid user data table name
tpudt_id Foreign key to id in tile pyramid user data table
scale* Scale as a multiple relative to the unit of measure (Default 1)
offset* The offset to the 0 valuet (Default 0)
min** Minimum value of this tile
max** Maximum value of this tile
mean** The arithmetic mean of values in this tile
std_dev** The standard deviation of values in this tile

* Only used for “integer” datatype

** These values are natural, not scaled or offset

Using Scale and Offset

Integer values may be scaled and offset in order to make more efficient use of 16-bit integer space available in PNG files. The scale and offset may be applied to the entire coverage and/or the individual tile. The scale and offset do not apply to the data_null value.

Actual cell values are be calculated by:

  1. multiplying the stored value by the gpkg_2d_gridded_tile_ancillary_table.scale value and then adding the gpkg_2d_gridded_tile_ancillary_table.offset,
  2. multiplying that value by the gpkg_2d_gridded_coverage_ancillary.scale value and then adding the gpkg_2d_gridded_coverage_ancillary.offset.

In pseudo-code, this conversion would look like:

elevationInUnitOfMeasure = (SomeGrid_RegularCoverage.tile_data→pngpixels[i] *
   gpkg_2d_gridded_tile_ancillary.scale + gpkg_2d_gridded_tile_ancillary.offset) *
   gpkg_2d_gridded_coverage_ancillary.scale + gpkg_2d_gridded_coverage_ancillary.offset;

PNG Encoding

Encode integer data using the PNG format. Pixel values are 16-bit unsigned integer (single channel - “greyscale”).

TIFF Encoding

Encode floating point data using the TIFF format. Tiles are encoded as a single-band image using one 32-bit floating point component per pixel. Each TIFF encoded tile is a baseline TIFF as defined in the Part 1 of the TIFF standard.

This implies a number of constraints which are listed below:

The only allowed encoding extensions are: