- Title: Rendering
- Identifier: https://stac-extensions.github.io/render/v2.1.0/schema.json
- Field Name Prefix: renders
- Scope: Item, Collection
- Extension Maturity Classification: Pilot
- Owner: @emmanuelmathot @abarciauskas-bgse @smohiudd
This document explains the Rendering Extension to the SpatioTemporal Asset Catalog (STAC) specification.
The Rendering Extension describes how the pixel values of raster assets are transformed into an image: which assets and bands are used, and how their values are computed, scaled and colored.
A render is independent of the software that draws it. The same render can be used by a dynamic tile server, by a web mapping library that reads the assets directly, or by a desktop GIS. Renderer integration shows how to translate a render for specific software.
A render does not describe a map. The projection, the default extent, the order of the layers and the resolution range in which a layer is visible are defined by the Maps Extension. The services that deliver a render are described by the Web Map Links Extension, see Links.
- Examples:
- Landsat-8 example: Shows the basic usage of the extension in a landsat-8 STAC Item
- Sentinel-2 example: Shows the basic usage of the extension in a Sentinel-2 STAC Item
- Planet example: Shows
bidxselecting named bands from a single multi-band asset - Collection example: Shows the basic usage of the extension in a collection
- JSON Schema
- Changelog
The fields in the table below can be used in these parts of STAC documents:
- Catalogs
- Collections
- Item Properties (incl. Summaries in Collections)
- Assets (for both Collections and Items, incl. Item Asset Definitions in Collections)
- Links
| Field Name | Type | Description |
|---|---|---|
| renders | Map<string, Render Object> | REQUIRED. Dictionary of rendering objects that can be viewed, each with a unique key. |
| Field Name | Type | Description |
|---|---|---|
| assets | [string] | REQUIRED. Array of asset keys referencing the assets that are used to make the rendering |
| title | string | Optional title of the rendering |
| rescale | [float] | 2 dimensions array of delimited Min,Max range per band. If not provided, the data will not be rescaled. |
| nodata | float, string | Nodata value to use for this render, overriding any nodata value already defined on the referenced assets (e.g. via the raster extension). If not set, implementations SHOULD fall back to the asset's own nodata value. |
| colormap_name | string | Name of a standard matplotlib colormap (e.g. viridis, YlGn), including the reversed _r variants. The schema validates it against the colormaps registered in matplotlib 3.11.2, case-sensitively. Other names are not permitted, use colormap instead. See Colormaps. |
| colormap | Colormap Object | An explicit colormap. It takes precedence over colormap_name. See Colormaps. |
| color_formula | string | Color formula that must be applied for a raster band |
| resampling | string | Resampling algorithm to apply to the referenced assets, one of the values in Resampling. If not set, the renderer selects the algorithm. |
| expression | string, [any] | Expression that computes the rendered value(s) from the referenced assets, e.g. a band arithmetic formula. Its dialect is given by expression_type. See Expression dialects. |
| expression_type | string | Dialect of expression, one of the values in Expression dialects. Defaults to numexpr. If it is set, expression MUST also be set. |
| bidx | [[int, string]] | Band(s) to select from each referenced asset, one entry per position in assets (an asset needing no sub-selection uses an empty array []). Each selector is either a 1-based band index (matching the GDAL/rio-tiler/titiler convention) or a band name matching the name of a Band Object declared on that asset (via eo:bands, raster:bands, or the STAC common bands construct) — useful since name is not required on a Band Object. See Band references. |
| asset_as_band | boolean | Treat assets in expression as single bands. Required when expression uses multiple assets |
The render object is open ended, so additional fields can be provided according to the needs of the rendering application.
In v2.x and earlier, a render had the field minmax_zoom. It was removed, because a zoom level has a different
meaning in each mapping library and tiling scheme. Use min_resolution and max_resolution of a layer in the
Maps Extension instead.
A colormap gives a color to each value of a single band. This band is the selected band of the asset or the
result of expression. There are two ways to give a colormap:
colormap_name: a name from a fixed list. The colormap is stretched across the range inrescale: the first color is for the minimum, the last color is for the maximum.colormap: an explicit Colormap Object. Its stops are data values.rescaledoes not apply to it.
If a render has the two fields, colormap takes precedence and clients MUST draw it as given.
In this case, colormap_name is only a hint: it SHOULD name the colormap that colormap describes,
and rescale SHOULD be the range that makes the two equal.
A render without a colormap can get its colors from the metadata of the band, e.g. color_hint in
classification:classes of the Classification Extension.
| Field Name | Type | Description |
|---|---|---|
| type | string | REQUIRED. One of interpolate, step or match. |
| stops | [Colormap Stop Object] | REQUIRED. The stops, in ascending order of value. Each value MUST be unique. interpolate needs a minimum of two stops, the other types a minimum of one. |
The type tells how the values between and outside the stops are drawn:
| Type | Between the stops | Outside the stops |
|---|---|---|
interpolate |
Linear interpolation in sRGB between the two adjacent stops. | Clamped: the color of the first stop below it, the color of the last stop above it. |
step |
A stop applies from its value (included) to the value of the next stop (excluded). |
The last stop applies to all values above it. Values below the first stop are transparent. |
match |
Only values equal to a stop are drawn. | All other values are transparent. |
For all types, nodata values are transparent.
| Field Name | Type | Description |
|---|---|---|
| value | number | REQUIRED. The data value of the stop. |
| color | string | REQUIRED. The color as a hexadecimal string, #RRGGBB or #RRGGBBAA. |
| title | string | A short description of what the value means, e.g. the name of a class. Clients can use it in a legend. |
A continuous color ramp:
"colormap": {
"type": "interpolate",
"stops": [
{ "value": -1, "color": "#A50026" },
{ "value": 0, "color": "#FFFFBF" },
{ "value": 1, "color": "#006837" }
]
}Classes from value ranges:
"colormap": {
"type": "step",
"stops": [
{ "value": -1, "color": "#A50026", "title": "Water" },
{ "value": 0.2, "color": "#FFFFBF", "title": "Sparse vegetation" },
{ "value": 0.5, "color": "#006837", "title": "Dense vegetation" }
]
}Classes from exact values:
"colormap": {
"type": "match",
"stops": [
{ "value": 1, "color": "#1A9850", "title": "Forest" },
{ "value": 2, "color": "#D73027", "title": "Urban" }
]
}In v2.x and earlier, colormap was an object without a schema, in the format of TiTiler. This form is no
longer valid. A dictionary of values and colors becomes a match colormap, a list of intervals becomes a
step colormap.
The assets field is a list of asset keys referencing the assets that are used to make the rendering.
The assets MUST be local assets defined in the same item.
Note
When it is intended to use assets from external items or specific bands in an asset,
it is recommended to define a virtual asset
and then reference its key in the assets field. See the NDVI example.
The positioning of the source assets is defined by their position in the assets array.
Typically, in the case of the composition of a RGB image, the first pointer would be the red band,
the second the green band and the third the blue band.
"assets": [ "red", "green", "blue" ]When one or more of the referenced assets is itself a multi-band raster, bidx selects which band(s) of
each asset to use.
bidx is an array with one entry per position in assets (bidx.length MUST equal assets.length),
where each entry is itself an array of the band selector(s) for that asset, in output order. An asset that
needs no sub-selection (e.g. it is already single-band, or all its bands should be used in their existing
order) uses an empty array []. Note that JSON Schema cannot enforce the bidx.length == assets.length rule
itself; it is a MUST, not a validated constraint.
Each selector is either:
- a 1-based band index (an integer
>= 1, matching the GDAL/rio-tiler/titiler convention), with no required correspondence to any STAC band metadata — only meaningful if you already know how that asset's bands are physically ordered; or - a band name, which MUST match the
nameof a Band Object declared on that asset, whether via itseo:bands,raster:bands, or the STAC 1.1+ commonbandsconstruct (all three use the samenameproperty). This ties the reference to metadata already present in the Item or Asset, rather than to an implementation's internal band ordering. Sincenameis not a required property of a Band Object, a name-based selector is only usable when the asset's bands actually declare one — fall back to an index otherwise.
"assets": [ "B04", "stacked" ],
"bidx": [ [], [ 3, "nir" ] ]Here, B04 is used as-is (empty array: no sub-selection needed), while two bands are selected from the
multi-band stacked asset: its 3rd band by index, and the band named nir.
Warning: Band indexes are 1-based: the first band of an asset is
1, not0. This is different from the 0-based position of a Band Object in the asset'sbandsarray. Thus, the band atbands[2]has the index3. The JSON Schema rejects0, but it cannot detect an off-by-one error for other values.
In v2.x and earlier, bidx was a flat array of numbers (e.g. "bidx": [1]) that was not tied to a specific
asset. This form is no longer valid. Change it to one inner array per asset, e.g. "bidx": [[1]] for a single
asset.
See the Planet example for a realistic case: PlanetScope's 8-band analytic
product is delivered as a single multi-band GeoTIFF asset (unlike Sentinel-2/Landsat-8, which split each band
into its own asset), so bidx is the only way to select, say, a true-color RGB composite from it:
"assets": [ "analytic" ],
"bidx": [ [ "red", "green", "blue" ] ]A renderer that only accepts a numeric, per-asset band index (e.g. titiler's inline
assets=<name>|bidx=<i1>,<i2> syntax, which replaced its older flat, non-per-asset bidx query parameter for
the same reason bidx here is now per-asset) resolves a name-based selector to a 1-based index by looking up
its position in that asset's own band metadata:
assets=B04&assets=stacked|bidx=3,5
(assuming red and nir are, respectively, the 3rd and 5th band declared on the stacked asset). Titiler
also accepts an inline |bands=<name1>,<name2> option; consult the target renderer's documentation for
whether it can resolve band names directly, or whether a client must perform this lookup itself.
A rescaling of the values from the source asset(s) to the rendered image can be defined using the rescale field.
It is specified as a 2 dimensions array of delimited Min,Max range per band.
"rescale": [
[0, 10000], // band 1
[0, 10000], // band 2
[0, 10000] // band 3
]A prescaling can also be performed according to the offset and scale fields value of the
raster extension.
resampling is the algorithm that computes a pixel of the image from the pixels of the data, when the two
grids are different (other resolution or other projection). Only the following values are permitted.
They are the algorithms of gdalwarp,
with the names that rasterio and TiTiler use:
resampling |
GDAL name | Algorithm |
|---|---|---|
nearest |
near |
Nearest neighbour. Use it for classes and other discrete values. |
bilinear |
bilinear |
Bilinear interpolation |
cubic |
cubic |
Cubic convolution |
cubic_spline |
cubicspline |
Cubic B-spline |
lanczos |
lanczos |
Lanczos windowed sinc |
average |
average |
Weighted average of the contributing pixels |
rms |
rms |
Root mean square of the contributing pixels |
mode |
mode |
Most frequent value of the contributing pixels |
max |
max |
Maximum of the contributing pixels |
min |
min |
Minimum of the contributing pixels |
med |
med |
Median of the contributing pixels |
q1 |
q1 |
First quartile of the contributing pixels |
q3 |
q3 |
Third quartile of the contributing pixels |
sum |
sum |
Weighted sum of the contributing pixels |
A renderer that does not support the algorithm SHOULD use the most similar algorithm that it supports.
An expression can be written in different dialects, which are not compatible with each other.
expression_type identifies the dialect, so that a client knows how to read the expression or that it
can't read it. Only the following values are permitted:
expression_type |
expression |
Dialect |
|---|---|---|
numexpr (default) |
string | A formula with the operators and functions of NumExpr, as used by TiTiler and rio-tiler. |
openlayers |
[any] | An OpenLayers expression, as used in the styles of WebGL tile layers. |
If expression_type is not provided, the expression is a NumExpr string.
An array is thus only permitted together with its expression_type.
The same NDVI formula in the two dialects:
"expression": "(B08-B04)/(B08+B04)""expression": ["/", ["-", ["band", 2], ["band", 1]], ["+", ["band", 2], ["band", 1]]],
"expression_type": "openlayers"In an OpenLayers expression, ["band", n] is the n-th selected band, in the order given by assets and bidx,
starting at 1.
A client that does not support the dialect of a render SHOULD NOT draw the render, or SHOULD use a web map link that delivers it (see Links).
More dialects can be added in future versions of this extension. Stylesheets for complete style documents (e.g. SLD or MapLibre styles) are not expressions. They are defined in the Maps Extension.
The render objects are designed to be used by dynamic tile servers and by client-side rendering libraries to produce a visualization from a STAC Item. They are generic enough to be used by any renderer. In the following sections, some renderer integrations are described.
titiler offers a native STAC reader.
The following table describes the titiler query parameters that could be used and the corresponding extension fields.
Either the client building titiler url can use the information in the virtual asset to build the query parameters
or the dynamic tile server could use the information in the virtual asset to build the query parameters
by simply specifying the url and assets query parameters.
| Query key | field | Description |
|---|---|---|
url |
href in item self link |
STAC Item URL |
assets |
assets |
Assets keys to use for the tile rendering defined in the assets field |
rescale |
rescale |
Delimited Min,Max bounds defined in rescale field. |
expression |
expression |
Band arithmetic formula as defined in field expression |
nodata |
nodata or nodata raster:bands |
If not provided in nodata field, the nodata value can be read from the nodata field of the corresponding raster:bands object. |
unscale |
scale and offset in raster:bands |
Scale and Offset value defined in scale and offset fields of the corresponding raster:bands item |
colormap_name |
colormap_name |
Color map name defined in the colormap_name field, in lowercase. Not sent if colormap is present. |
colormap |
colormap |
Color map converted from the Colormap Object, see below (overrides colormap_name if present). |
color_formula |
color_formula |
Color formula as defined in color_formula field of the asset |
reproject, resampling |
resampling |
reproject gets each value. resampling gets the same value only for nearest, bilinear, cubic, cubic_spline, lanczos, average, mode and rms. For the other values, resampling is not set. |
assets=<name>|bidx=<i1>,<i2> (or the legacy bidx param) |
bidx, resolving any name-based selector to a 1-based index via the asset's band metadata |
Per-asset dataset band indexes. See Band references. |
asset_as_band |
asset_as_band |
Required when expression uses multiple single-band assets |
Titiler delegates colormaps to rio-tiler's built-in registry
(rio_tiler.colormap.cmap), which is derived from matplotlib's colormaps but is not an exact match:
- Names are lowercased (
colormap_name: "YlGn"must be sent to titiler asylgn). - Reversed colormaps use matplotlib's
_rsuffix convention (e.g.viridis_r). - The registry also includes some non-matplotlib colormaps (e.g. from cmocean), and does not guarantee coverage of every matplotlib colormap name.
A client sending colormap_name to titiler MUST lowercase the value first, and SHOULD verify the resulting
name is one titiler actually supports (GET /colorMaps lists the registered names) before assuming a match.
Titiler does not read the Colormap Object directly. A client converts it to the
JSON value of the colormap query parameter and does not send rescale:
| Type | Titiler colormap value |
|---|---|
match |
A dictionary with one entry for each stop, e.g. {"1": "#1A9850", "2": "#D73027"}. |
step |
A list of intervals, one for each stop, from its value to the value of the next stop, e.g. [[[-1, 0.2], "#A50026"], [[0.2, 0.5], "#FFFFBF"], [[0.5, 1], "#006837"]]. The last interval ends at the maximum of the data. |
interpolate |
No direct equivalent. The client computes a list of narrow intervals (e.g. 256) between the first and the last stop, with interpolated colors. |
From the Sentinel-2 item:
"properties":{
"renders":{
"sir":
{
"title": "Shortwave Infra-red",
"assets": [ "B12", "B08", "B04" ],
"rescale": [[0,5000],[0,7000],[0,9000]],
"resampling": "nearest"
}
}
}| Query key | value | Example value |
|---|---|---|
| url | STAC Item URL | https://raw.githubusercontent.com/stac-extensions/render/main/examples/item-sentinel2.json |
| assets | Assets keys defined in the assets fields |
B12,B08,B04 |
| rescale | Delimited Min,Max bounds defined in rescale field |
0,5000,0,7000,0,9000 |
Example URL, using a self-hosted or public titiler instance
(the assets and rescale parameters are repeated, one per band):
https://<titiler-endpoint>/stac/bbox/13.86148243891681,36.95257399124932,15.111074610520053,37.94752813015372/512x512.png?url=https://raw.githubusercontent.com/stac-extensions/render/main/examples/item-sentinel2.json&assets=B12&assets=B08&assets=B04&reproject=nearest&resampling=nearest&rescale=0,5000&rescale=0,7000&rescale=0,9000&return_mask=true
Result: Lava thermal signature of Mount Etna eruption (February 2021)
From the Sentinel-2 item: This example uses the virtual assets to define the NDVI asset first because in this use case, the NDVI asset could also be downloaded as a standalone asset.
"assets":{
"ndvi":
{
"roles": [ "virtual", "data", "index" ],
"type": "image/vnd.stac.geotiff; cloud-optimized=true",
"href": "https://raw.githubusercontent.com/stac-extensions/render/main/examples/item-sentinel2.json#/assets/ndvi",
"vrt:hrefs": [
{ "key": "B04", "href": "https://raw.githubusercontent.com/stac-extensions/render/main/examples/item-sentinel2.json#/assets/B04"},
{ "key": "B08", "href": "https://raw.githubusercontent.com/stac-extensions/render/main/examples/item-sentinel2.json#/assets/B08"}],
"title": "Normalized Difference Vegetation Index",
"vrt:algorithm": "band_arithmetic",
"vrt:algorithm_opts": {
"expression": "(B08-B04)/(B08+B04)",
"rescale": [[-1,1]]
},
}
},
"properties":{
"renders":{
"ndvi":
{
"title": "Normalized Difference Vegetation Index",
"assets": [ "ndvi" ],
"resampling": "average",
"colormap_name": "YlGn"
}
}
}
If this case, the parameters to titiler must be extracted from both the virtual asset definition and the render object.
| Query key | value | Example value |
|---|---|---|
| url | STAC Item URL | https://raw.githubusercontent.com/stac-extensions/render/main/examples/item-sentinel2.json |
| assets | Assets used in the expression, in the order they are referenced | B08,B04 |
| expression | Band math formula as defined in field vrt:algorithm |
(B08-B04)/(B08+B04) |
| rescale | Delimited Min,Max bounds defined in rescale field |
-1,1 |
| colormap_name | Color map name as defined in colormap_name, lowercased |
ylgn |
| reproject, resampling | Resampling algorithm as defined in resampling |
average |
Example URL, using a self-hosted or public titiler instance.
titiler combines multiple assets positionally, so the expression sent to titiler must reference them as
b1, b2, ... in the order given by assets (here b1 = B08, b2 = B04), rather than by their asset names:
https://<titiler-endpoint>/stac/preview.png?url=https://raw.githubusercontent.com/stac-extensions/render/main/examples/item-sentinel2.json&assets=B08&assets=B04&expression=(b1-b2)/(b1%2Bb2)&max_size=512&width=512&reproject=average&resampling=average&rescale=-1,1&colormap_name=ylgn&return_mask=true
Result: Sentinel-2 Normalized Difference Vegetation Index (NDVI), tile 33SVB (Sicily, Italy).
Obviously, the same rendering can be applied to local source assets without using the virtual asset.
"properties":{
"renders":{
"ndvi":
{
"title": "Normalized Difference Vegetation Index",
"assets": [ "B08", "B04" ],
"resampling": "average",
"colormap_name": "YlGn",
"expression": "(B08-B04)/(B08+B04)",
"rescale": [[-1,1]]
}
}
}OpenLayers renders directly in the browser: there is no tile server, so a client
maps render fields onto OpenLayers constructs itself.
Stylesheets for vector data are not part of this extension, see the
Maps Extension.
A GeoTIFF source reads
one or more (Cloud Optimized) GeoTIFFs, and a
WebGLTileLayer
renders it using a style expression (from ol/expr/expression).
| OL construct | field | Description |
|---|---|---|
One sources entry per asset href |
assets |
Order determines the ['band', N] index (1-based) referencing that asset |
['interpolate', ['linear'], ['band', N], min, 0, max, 1], composed per band with ['array', ...] |
rescale |
Per-band Min,Max bounds |
['palette', index, colors] (discrete) or ['interpolate', ...] color stops (continuous) |
colormap_name / colormap |
OpenLayers ships no named palettes; color stops/values must be supplied explicitly |
sources[].nodata |
nodata |
Nodata value for that source |
a numeric ol/expr/expression assigned to style.color, using the same operators as above |
expression (when expression_type is openlayers) |
See ol/expr/expression for the full operator list, including arithmetic |
| — | expression (when expression_type is numexpr or not set) |
OpenLayers can't read a NumExpr string. The client translates the formula to an ol/expr/expression, or uses a web map link that delivers the render |
interpolate option of the GeoTIFF source |
resampling |
false for nearest (nearest neighbour), true for all other values (linear interpolation, the default) |
Example, rendering the Shortwave Infra-red example's
sir render (assets: ["B12", "B08", "B04"], rescale: [[0,5000],[0,7000],[0,9000]]):
import GeoTIFF from 'ol/source/GeoTIFF.js';
import TileLayer from 'ol/layer/WebGLTile.js';
const source = new GeoTIFF({
sources: [
{ url: 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/33/S/VB/2021/2/S2B_33SVB_20210221_0_L2A/B12.tif' }, // band 1
{ url: 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/33/S/VB/2021/2/S2B_33SVB_20210221_0_L2A/B08.tif' }, // band 2
{ url: 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/33/S/VB/2021/2/S2B_33SVB_20210221_0_L2A/B04.tif' }, // band 3
],
});
const layer = new TileLayer({
source,
style: {
color: [
'array',
['interpolate', ['linear'], ['band', 1], 0, 0, 5000, 1],
['interpolate', ['linear'], ['band', 2], 0, 0, 7000, 1],
['interpolate', ['linear'], ['band', 3], 0, 0, 9000, 1],
1,
],
},
});If a service delivers a render (e.g. a dynamic tile server), it is recommended to add a web map link to the
links section, as described in the Web Map Link extension.
A web map link is not required: a client can also draw a render directly from the assets.
A web map link can be extended with the attribute render
with a value corresponding to the key of the render object in the renders field
in order to provide a cross link to the render object.
{
"rel": "xyz",
"type": "image/png",
"title": "NDVI",
"href": "https://<titiler-endpoint>/stac/preview.png?url=https://raw.githubusercontent.com/stac-extensions/render/main/examples/item-sentinel2.json&assets=B08&assets=B04&expression=(b1-b2)/(b1%2Bb2)&max_size=512&width=512&reproject=average&resampling=average&rescale=-1,1&colormap_name=ylgn&return_mask=true",
"render": "ndvi"
}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.
The same checks that run as checks on PR's 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 installThen to check markdown formatting and test the examples against the JSON schema, you can run:
npm testThis 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
