Skip to content
stac-extensionsPublic

About

Create maps from STAC data sources

Resources

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Maps Extension Specification

This document explains the Maps Extension to the SpatioTemporal Asset Catalog (STAC) specification.

A map combines several layers into a single view with a projection and a default extent. The layers can come from assets, web map links or renders, and a stylesheet can be applied to the data of an asset or a service. Multiple maps can be provided, e.g. to offer different visualizations of the same data.

This extension doesn't depend on other extensions. It uses the web map links of the Web Map Links Extension and the renders of the Render Extension if a document provides them.

Fields

The fields in the table below can be used in these parts of STAC documents:

  • Catalogs
  • Collections
  • Item Properties
  • Assets (for both Collections and Items, incl. Item Asset Definitions in Collections and Asset Templates)
  • Links (incl. Link Templates), only id
  • Bands
Field Name Type Description
maps Map<string, Map Object> REQUIRED. Named maps. The keys SHOULD match ^[A-Za-z0-9_-]+$.

In Catalogs and Collections, maps is a top-level field. In Items, it's part of the properties.

A STAC entity can provide several maps as alternative views, e.g. one map per data layer. Clients can let users switch between the maps, e.g. with a map picker.

Map Object

Field Name Type Description
title string A title for the map, e.g. for a map picker.
description string A description of the map. CommonMark 0.29 syntax MAY be used for rich text representation.
roles [string] default marks the map that clients show by default. At most one map SHOULD have this role. If none or multiple have it, clients choose one.
proj:code string|null The projection of the map, as defined in the Projection Extension.
proj:wkt2 string|null The projection of the map, as defined in the Projection Extension.
proj:projjson object|null The projection of the map, as defined in the Projection Extension.
bbox [number] The default extent of the map in WGS 84 (EPSG:4326), with 4 or 6 numbers as for the bbox of Items.
dimensions Map<string, *> Default values for the non-spatial dimensions of all layers (e.g. a common time).
layers [Layer Object] REQUIRED. The layers of the map, from bottom to top. Can't be empty.

If no projection is provided, clients choose one, e.g. Web Mercator. If multiple projection fields are provided, they MUST describe the same projection.

If no bbox is provided, clients use the spatial extent of the STAC entity.

dimensions: The keys are the names of the dimensions as defined in cube:dimensions of the Datacube Extension, e.g. time. Clients match them case-insensitively to the dimensions of a layer's source. For WMS, time and elevation map to the parameters TIME and ELEVATION, all other dimensions to DIM_<name>. For WMTS, they map to the dimension identifiers of the layer. The values apply wherever a layer's source doesn't set its own value, e.g. through dimensions in a web map link. For services whose dimension names differ, set the values in the link instead.

Layer Object

A layer has exactly one source and optionally a style.

Field Name Type Description
asset string Source: The key of an asset.
link string|Link Object|Link Template Object Source: The id of a link or link template in the document, or an embedded link for layers from outside of the document (e.g. a basemap).
render string Source: The key of a render. The render provides its own data and portrayal.
style Style Reference Object The stylesheet that is applied to the data of an asset or link source.
title string A title for the layer, e.g. for a layer switcher. Overrides the title of the source.
opacity number The opacity of the layer, between 0 (transparent) and 1 (opaque). Defaults to 1.
visible boolean Whether the layer is visible when the map loads. Defaults to true.
min_resolution number The finest resolution at which the layer is shown, see resolution ranges.
max_resolution number The coarsest resolution at which the layer is shown, see resolution ranges.

Each layer MUST provide exactly one of asset, link and render. The keys and ids refer to assets, links and renders in the same document as the map. For example, a map in an Item can only use the assets, links and renders of that Item, not those of its Collection.

link: Web map links from the document are referenced by their id, which avoids duplicating them. Embedding a link is meant for layers that are not part of the document, e.g. a basemap from a third party. Embedded links follow the definitions of the web map link in use, e.g. from the Web Map Links Extension.

style:

  • It MUST NOT be provided for a render source, as a render has its own portrayal.
  • For a link source, it can only be provided for services that deliver data instead of images, e.g. vector tiles through XYZ, TileJSON or PMTiles.

min_resolution and max_resolution: They define where the layer is visible, independent of the zoom levels for which a service provides content. Clients can still show a service beyond its highest zoom level by scaling up the tiles.

Style Reference Object

Field Name Type Description
link string|Link Object The id of a stylesheet link in the document, or an embedded stylesheet link.
asset string The key of a stylesheet asset in the document.

Each Style Reference Object MUST provide exactly one of link and asset.

link: Stylesheet links use the relation type stylesheet, which is registered by IANA.

asset: Stylesheet assets SHOULD have the role style.

For both, the type is REQUIRED and identifies the encoding of the stylesheet, preferably with the media types of OGC API - Styles, e.g. application/vnd.mapbox.style+json or application/vnd.ogc.sld+xml.

The layer's source replaces the sources in the stylesheet. A complete map defined in a stylesheet (e.g. with several sources or a basemap) can be linked directly, but not used as a layer style.

Which parts of a stylesheet are applied depends on its encoding and on the source. For Mapbox and MapLibre styles (application/vnd.mapbox.style+json):

  • If the source has named layers (vector tiles, e.g. through XYZ, TileJSON or PMTiles), only the style layers whose source-layer exists in the data are applied.
  • If the source has no named layers (a single set of features, e.g. GeoJSON, GeoParquet or FlatGeobuf), source-layer is ignored and all style layers that can draw the data are applied.

This allows one stylesheet to be used for the vector tiles and for the original file of the same data. For other encodings (e.g. SLD), clients select the rules with the mechanism of the encoding.

A render can't be used as a style. It always references its own data and is used as a layer source instead, see render in the Layer Object.

Possible combinations

The following table shows the possible combinations of sources and styles:

Layer Shows
{"asset": "visual"} The asset with the default portrayal of the client, e.g. an RGB image or a default vector style.
{"asset": "fields", "style": {"link": "fields-outline"}} The asset, styled by a stylesheet.
{"render": "ndvi"} A render with its own data, rendered by the client or delivered by a web map link that references the render.
{"link": "topo-wms"} A service as it's delivered.
{"link": "fields-pmtiles", "style": {"link": "fields-outline"}} The data of a service, styled by a stylesheet.
{"link": {"rel": "xyz", "href": "…"}} A layer from outside of the document.

Resolving layers

Clients resolve each layer as follows:

  1. asset: Read the asset. Apply the style if provided, otherwise use the default portrayal of the client.
  2. link: Load the service. Apply the style to its data if provided.
  3. render: If the client supports the render and can read its data, render it on the client. Otherwise, use a web map link that indicates that it delivers the render (e.g. through the field render) and that the client supports. If multiple links match, they are equivalent and the client can choose any of them.
  4. If none of the above works, skip the layer and inform the user.

Clients that don't support this extension usually fall back to showing the assets, renders or web map links directly.

Resolution ranges

min_resolution and max_resolution define the range of resolutions in which a layer is shown. Clients SHOULD hide the layer outside of this range. min_resolution is inclusive and max_resolution is exclusive, i.e. the layer is shown if min_resolution <= resolution < max_resolution, e.g. as in OpenLayers. If both are provided, min_resolution must be lower than max_resolution.

The resolution is the distance on the ground in meters per display (CSS) pixel, measured at the center of the map's bbox if provided, otherwise of the spatial extent of the STAC entity (bbox in Items, the first bounding box of the spatial extent in Collections). This makes the value independent of the projection of the map. Clients convert the value into the units of the map projection, e.g. with getPointResolution in OpenLayers.

For example, a max_resolution of 1000 for data centered at 48° North converts to:

Map projection Resolution in map units
EPSG:25832 (UTM zone 32N) ≈ 1000 m per pixel
EPSG:3857 (Web Mercator) ≈ 1000 / cos(48°) ≈ 1494 m per pixel
EPSG:4326 (WGS 84) ≈ 0.0134° per pixel horizontally, ≈ 0.0090° per pixel vertically

The ground resolution varies over large extents, so the range is approximate far from the center. Clients MAY evaluate it at the center of the current view instead, which is also the fallback for Catalogs and other cases where no spatial extent is available.

The data-side counterpart is raster:spatial_resolution of the Raster Extension, which is also measured in meters on the ground. For example, a layer with categorical data may set its min_resolution to the raster:spatial_resolution so that it's not shown beyond the resolution of the data. gsd is not suitable to derive the range as it describes the sensor, not the pixels of the data.

Link identifiers

This extension adds the following field to the Link Object and the Link Template Object of the Link Templates Extension:

Field Name Type Description
id string An identifier for the link, which MUST be unique across all links and linkTemplates of the document. REQUIRED for links that are referenced by a map.

Links are never referenced by their position in the array, as the order can change, e.g. when a STAC API adds or regenerates links such as self, root or parent.

Relation to other specifications

  • Render Extension: A render describes how data is portrayed. A map decides which renders are shown together, and where. Visibility ranges are therefore defined for the map layers, not for renders.
  • Web Map Links Extension: Web map links describe services. A map references them as layers by their id. A web map link can indicate that it delivers a render (e.g. through the field render), so that clients can choose between rendering on the client and using the service.
  • Link Templates Extension: Link templates are referenced by their id like links.
  • Projection Extension: The fields proj:code, proj:wkt2 and proj:projjson are used to define the projection of a map.
  • OGC API - Maps: The map resources of OGC API - Maps (e.g. /map and /styles/{styleId}/map) are services that deliver images. They are described as web map links and can be used as layers in the maps of this extension.
  • OGC API - Styles: Stylesheet links follow OGC API - Styles, i.e. the relation type stylesheet and the media types for the encodings.

Contributing

All contributions are subject to the STAC Specification Code of Conduct. For contributions, please follow the STAC specification contributing guide Instructions for running tests are copied here for convenience.

Running tests

The same checks that run as checks on PRs are part of the repository and can be run locally to verify that changes are valid. To run tests locally, you'll need npm, which is a standard part of any node.js installation.

First you'll need to install everything with npm once. Just navigate to the root of this repository and on your command line run:

npm install

Then to check markdown formatting and test the examples against the JSON schema, you can run:

npm test

This will spit out the same texts that you see online, and you can then go and fix your markdown or examples.

If the tests reveal formatting problems with the examples, you can fix them with:

npm run format-examples

About

Create maps from STAC data sources

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors