STAC-notes
A wiki to put your tips, links, references
Below a short description of STAC (Spatio-Temporal Asset Catalog).
What is STAC ?
A STAC collection or catalog is a nested dict (json) listing the metadata of a number of items (e.g. a remote sensing acquisition) and their assets (e.g. raster bands, quicklook, thumbnails, xml files, ...).
In order to limit size and allow fast queries, the nested dict is split into a tree of dict linking to each other (parent and child), from top level to bottom:
catalog > collections > sub-collections > ... > items > assets.
An "item collection" is usually what you will be using at the end, that is a list of items that was subset from a catalog or collection.
Items
The required fields for an item (without type
and stac_version
that are automatically filled by pystac.Item
):
-
id
: name under which the item will be registered -
geometry
: a geojson geometry in dict, see shapely.to_geojson followed by json.loads -
bbox
(List[float]): the bounding box of the item -
properties
(dict): with at least field "datetime" for the date of acquisition. -
links
List[dict]: the links to the parent collections. Thus it is optional forItemCollection
. Optional: -
stac_extensions
(List[str]): list of the schema URIs used for validation, e.g. pystac.extensions.eo.SCHEMA_URI
Assets
The only required field for a stac asset is the href
(i.e. URI to the file, e.g. a raster file) and
the key
(usually the band name) under which it will be registered in the Item.
Optional but recommended:
-
title
(str): usually the band name -
type
(str): seelist(pystac.MediaType)
or https://github.com/radiantearth/stac-spec/blob/master/best-practices.md#working-with-media-types -
roles
(List[str]): thumbnail, overview, data, metadata -
extra_fields
(dict): all the rest of the metadata, in particular exetnsion fields
Other fields are also recommended, especially for satellite data: https://github.com/radiantearth/stac-spec/blob/master/item-spec/common-metadata.md and https://github.com/radiantearth/stac-spec/blob/master/item-spec/common-metadata.md#instrument
Extensions
Several extensions define the commonly used properties when searching (e.g. the band name/wavelength/bandwidth, the coordinate system, the MGRS code, ...). These standards are referenced in https://stac-extensions.github.io/#grouped-by-maturity.
With the Electro-Optical extension the additionnal fields (extra_fields) are
-
eo:bands
(List[dict]): each item of the list corresponds to a band of the band file see https://github.com/stac-extensions/eo/#band-object for specs (names and types)-
name
(str): band name -
common_name
(str): the color name for the reflectance bands -
description
(str) -
center_wavelength
(number) -
full_width_half_max
(number) -
solar_illumination
(number)
-
With the Projection extension the additionnal fields are: See https://github.com/stac-extensions/projection/#projection-extension-specification and https://github.com/stac-extensions/projection/#best-practices
proj:epsg
proj:wkt2
proj:projjson
proj:geometry
proj:bbox
-
proj:centroid
(dict(lat, lon)) -
proj:shape
(List[height, width]): https://github.com/stac-extensions/projection/#projshape -
proj:transform
The projection information can be set at the item level if it is the same for all bands. Recommendations are to set it at the asset level if it differs from
Although the extension fields are all "optional", if used it must be in the good format, the item validation fails otherwise.
Ressources
A good place to get started is: https://stacspec.org/en/tutorials/
In order to build your own STAC with your local data: https://forgemia.inra.fr/umr-tetis/stac/simplestac
Other tutorials:
- on Landsat, but convertible to Sentinel is available here: https://pystac.readthedocs.io/en/stable/tutorials/creating-a-landsat-stac.html
Catalogs
- Copernicus: on the roadmap historical Sentinel assets should be available from STAC API in May 2024