Skip to main content

Raster Recipe

Current version: 1

A raster recipe is a JSON document containing configuration options that tells Raster MTS how to turn raster source data into Raster tiles.

Recipes must be constructed according to the rules in this recipe reference.

Recipe top-level fields

A recipe is a JSON object that must contain the following top-level fields:

Required fieldsDescriptionData type
version The version of the Mapbox Tiling Service recipe reference that the recipe uses.Integer
type Key to show this as a Raster MTS recipe for imagery data"raster"
sources List of input source filesList<SourceObject>
minzoom The lowest zoom level for the tileset. For more information about this option, see the Zoom Levels section.Integer
maxzoom The highest zoom level for the tileset. For more information about this option, see the Zoom Levels section.Integer
layers The names of the layers and their configuration options.Object<String, LayerObject>
{
"version": 1,
"type": "raster",
"sources": [
{
"uri": "mapbox://tileset-source/{ACCOUNT}/{SOURCE_NAME}"
}
],
"minzoom": 16,
"maxzoom": 18,
"layers": {
"RGB": {
"source_rules": {
"filter": [
["==", ["get", "colorinterp"], "red"],
["==", ["get", "colorinterp"], "green"],
["==", ["get", "colorinterp"], "blue"]
]
}
}
}
}

Recipe version

The recipe version indicates the version of the Raster MTS recipe reference that the recipe uses. The current version is 1. Using any version other than the current version or a previous version will result in an error.

Sources

The recipe sources object is a list of sources used to generate a tileset. This list must contain at least a single source.

Source configuration

Required fieldsDescriptionData type
uri The URI of the source uploaded into Mapbox. Sources are always prefixed with the mapbox:// protocol.String

Optional source configuration

Optional fieldsDescriptionData type
crs The EPSG coordinate system code of the source file. This is an optional field and only necessary if the source file is missing a CRS. This will override the source file's CRS if passed in and the source file already contains a CRS.String

Zoom Levels

The minzoom and maxzoom fields are required and define the zoom levels at which the tileset is available. The minzoom field is the lowest zoom level at which the tileset is available, and the maxzoom field is the highest zoom level at which the tileset is available. maxzoom must be greater than or equal to minzoom. If you are unsure of the minzoom and maxzoom values for data, refer to this guide on zoom levels and what each pixel represent.

Layers

The recipe layers object contains key-value pairs associating the names of tile layers with their configuration. For each key-value pair, the key is the name of the layer, and the value is a LayerObject containing the configuration and options for the layer.

Each layer must have a name (for example "RGB" or "RGBA" in the example below).

Layer example

...
"layers": {
"RGB": {
"source_rules": {
"filter": [
["==", ["get", "colorinterp"], "red"],
["==", ["get", "colorinterp"], "green"],
["==", ["get", "colorinterp"], "blue"]
]
}
}
}
...

Source Rules

Source rules are additional configuration settings that can be added to the recipe for processing. They are built upon expressions. Below are the supported expression rules for "raster" recipes.

Optional fieldsDescriptionData type
filter Expression for selecting a single scalar element or vector elements of a rasterexpression | [expression, expression]

In raster recipes, source rules identify which bands are allotted to which RGB channels.

Was this page helpful?