> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/mapbox-tiling-service/llms.txt)

# Raster Recipe

**Current version:** `1`

A **raster recipe** is a JSON document containing configuration options that tells [Raster MTS](https://docs.mapbox.com/mapbox-tiling-service/raster/) how to turn raster source data into [Raster tiles](https://docs.mapbox.com/api/maps/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 fields | Description | Data type |
| --- | --- | --- |
| [**version**](#option-version) | The version of the Mapbox Tiling Service recipe reference that the recipe uses. | `Integer` |
| [**type**](#option-type) | Key to show this as a Raster MTS recipe for imagery data | `"raster"` |
| [**sources**](#option-sources) | List of input source files | `List<SourceObject>` |
| [**minzoom**](#option-minzoom) | The lowest zoom level for the tileset. For more information about this option, see the [Zoom Levels](#zoom-levels) section. | `Integer` |
| [**maxzoom**](#option-maxzoom) | The highest zoom level for the tileset. For more information about this option, see the [Zoom Levels](#zoom-levels) section. | `Integer` |
| [**layers**](#option-layers) | The names of the layers and their configuration options. | `Object<String, LayerObject>` |

```json
{
    "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 fields | Description | Data type |
| --- | --- | --- |
| [**uri**](#source-object-uri) | The URI of the source uploaded into Mapbox. Sources are always prefixed with the `mapbox://` protocol. | `String` |

### Optional source configuration

| Optional fields | Description | Data type |
| --- | --- | --- |
| [**crs**](#source-object-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](https://docs.mapbox.com/help/glossary/zoom-level/) 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](https://docs.mapbox.com/help/glossary/zoom-level/#zoom-levels-and-geographical-distance) 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

```json
...
"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](https://docs.mapbox.com/help/glossary/expression/). Below are the supported expression rules for "raster" recipes.

| Optional fields | Description | Data type |
| --- | --- | --- |
| [**filter**](#layer-object-filter) | Expression for selecting a single scalar element or vector elements of a raster | `expression` \| `[expression, expression]` |

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