Skip to content

Map block (v2)

A format-v2 map block (version: 2): the same capabilities as v1, split into a style: half (everything that erases to a MapLibre style.json) and a runtime: half (everything that degrades). Source and layer spec bodies are the v1 ones; their live-data and experience keys move under a nested runtime:. For the why, see Format v2.

Type: 2 · Required

Format version — v2 documents state version: 2

Type: "map" · Required

Block type

Type: string · Required

Unique block identifier

Type: object · Required

The style half — everything that erases to style.json

Path: style.basemap · Type: string (URL) | any

Base style URL or inline style object (v2 rename of v1 mapStyle)

Path: style.center · Type: [number, number]

Map center [longitude, latitude]

Path: style.zoom · Type: number · Range: 0 to 24

Zoom level (0-24)

Path: style.pitch · Type: number · Default: 0 · Range: 0 to 85

Camera pitch angle (0-85)

Path: style.bearing · Type: number · Default: 0 · Range: -180 to 180

Camera bearing (-180-180)

Path: style.metadata · Type: map of any

Style metadata (style-spec root metadata slot)

Path: style.state · Type: map of object

Spec-native runtime-tunable values, read via global-state

Same shape as state.

Path: style.images · Type: map of string | object

Named images for symbol layers and patterns — style half, merged into the sprite on export

Same shape as images.

Path: style.terrain · Type: object

3D terrain from a raster-dem source — style half, compiles to style.json terrain

Same shape as terrain.

Path: style.sky · Type: object

Sky, fog, and globe atmosphere — style half, compiles to style.json sky

Same shape as sky.

Path: style.projection · Type: object

Map projection (globe needs maplibre-gl >= 5) — style half, compiles to style.json projection

Same shape as projection.

Path: style.light · Type: object

The style-spec light shading fill-extrusion faces — style half, compiles to style.json light

Same shape as light.

Path: style.sources · Type: map of object

Map sources, each with an optional nested runtime:

Path: style.sources.<source-id> · Type: object

One of 6 variants, selected by type: geojson, vector, raster, raster-dem, image, video.

Path: style.sources.<source-id>.type · Type: "geojson" · Required

Source type

Path: style.sources.<source-id>.url · Type: string · Pattern: ^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/|\.\.?\/)

URL to fetch GeoJSON data

Path: style.sources.<source-id>.data · Type: GeoJSON

Inline GeoJSON object

Path: style.sources.<source-id>.cluster · Type: boolean

Enable point clustering

Path: style.sources.<source-id>.clusterRadius · Type: integer · Minimum: 0

Cluster radius in pixels (default: 50)

Path: style.sources.<source-id>.clusterMaxZoom · Type: number · Range: 0 to 24

Maximum zoom level to cluster points

Path: style.sources.<source-id>.clusterMinPoints · Type: integer · Minimum: 2

Minimum points to form a cluster

Path: style.sources.<source-id>.clusterProperties · Type: map of any

Aggregate cluster properties

Path: style.sources.<source-id>.tolerance · Type: number

Douglas-Peucker simplification tolerance (higher = simpler geometry)

Path: style.sources.<source-id>.buffer · Type: number

Tile buffer size on each side, in pixels at tile scale

Path: style.sources.<source-id>.lineMetrics · Type: boolean

Calculate line distance metrics (required for line-gradient)

Path: style.sources.<source-id>.generateId · Type: boolean

Assign feature ids from each feature’s index (enables feature-state)

Path: style.sources.<source-id>.promoteId · Type: string | map of string

Feature property to use as the feature id (for feature-state), or a map of source-layer name to property name

Path: style.sources.<source-id>.attribution · Type: string

Attribution text

Path: style.sources.<source-id>.runtime · Type: object · Default: {}

Per-source live-data configuration

Path: style.sources.<source-id>.runtime.refresh · Type: object

Polling refresh configuration

Same shape as sources.<source-id>.refresh (type: geojson).

Path: style.sources.<source-id>.runtime.stream · Type: object

WebSocket/SSE streaming configuration

Same shape as sources.<source-id>.stream (type: geojson).

Path: style.sources.<source-id>.runtime.cache · Type: object

Cache configuration

Same shape as sources.<source-id>.cache (type: geojson).

Path: style.sources.<source-id>.runtime.loading · Type: object

Loading UI configuration

Same shape as sources.<source-id>.loading (type: geojson).

Path: style.sources.<source-id>.runtime.prefetchedData · Type: GeoJSON

Pre-fetched inline GeoJSON from build time

Path: style.sources.<source-id>.runtime.fetchStrategy · Type: "runtime" | "build" | "hybrid" · Default: "runtime"

When to fetch data: runtime (default), build, or hybrid

Path: style.sources.<source-id>.type · Type: "vector" · Required

Source type

Path: style.sources.<source-id>.url · Type: string · Pattern: ^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/|\.\.?\/)

TileJSON URL

Path: style.sources.<source-id>.tiles · Type: string[]

Tile URL template array

Path: style.sources.<source-id>.minzoom · Type: number · Range: 0 to 24

Minimum zoom level

Path: style.sources.<source-id>.maxzoom · Type: number · Range: 0 to 24

Maximum zoom level

Path: style.sources.<source-id>.bounds · Type: [number, number, number, number]

Bounding box [west, south, east, north]

Path: style.sources.<source-id>.scheme · Type: "xyz" | "tms"

Tile coordinate scheme

Path: style.sources.<source-id>.attribution · Type: string

Attribution text

Path: style.sources.<source-id>.promoteId · Type: string | map of string

Feature property to use as the feature id (for feature-state), or a map of source-layer name to property name

Path: style.sources.<source-id>.volatile · Type: boolean

Skip the tile cache (MapLibre volatile); for frequently changing tiles

Path: style.sources.<source-id>.runtime · Type: object

Per-source live-data configuration

Path: style.sources.<source-id>.runtime.refresh · Type: object

Polling refresh configuration

Same shape as sources.<source-id>.refresh (type: geojson).

Path: style.sources.<source-id>.runtime.stream · Type: object

WebSocket/SSE streaming configuration

Same shape as sources.<source-id>.stream (type: geojson).

Path: style.sources.<source-id>.runtime.cache · Type: object

Cache configuration

Same shape as sources.<source-id>.cache (type: geojson).

Path: style.sources.<source-id>.runtime.loading · Type: object

Loading UI configuration

Same shape as sources.<source-id>.loading (type: geojson).

Path: style.sources.<source-id>.runtime.prefetchedData · Type: any

Pre-fetched data from build time

Path: style.sources.<source-id>.runtime.fetchStrategy · Type: "runtime" | "build" | "hybrid"

When to fetch data: runtime (default), build, or hybrid

Path: style.sources.<source-id>.type · Type: "raster" · Required

Source type

Path: style.sources.<source-id>.url · Type: string · Pattern: ^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/|\.\.?\/)

TileJSON URL

Path: style.sources.<source-id>.tiles · Type: string[]

Tile URL template array

Path: style.sources.<source-id>.tileSize · Type: integer · Default: 512 · Minimum: 1

Tile size in pixels

Path: style.sources.<source-id>.minzoom · Type: number · Range: 0 to 24

Minimum zoom level

Path: style.sources.<source-id>.maxzoom · Type: number · Range: 0 to 24

Maximum zoom level

Path: style.sources.<source-id>.bounds · Type: [number, number, number, number]

Bounding box [west, south, east, north]

Path: style.sources.<source-id>.scheme · Type: "xyz" | "tms"

Tile coordinate scheme

Path: style.sources.<source-id>.attribution · Type: string

Attribution text

Path: style.sources.<source-id>.volatile · Type: boolean

Skip the tile cache (MapLibre volatile); for frequently changing tiles

Path: style.sources.<source-id>.runtime · Type: object

Per-source live-data configuration

Same shape as style.sources.<source-id>.runtime (type: vector).

Path: style.sources.<source-id>.type · Type: "raster-dem" · Required

Source type

Path: style.sources.<source-id>.url · Type: string · Pattern: ^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/|\.\.?\/)

TileJSON URL

Path: style.sources.<source-id>.tiles · Type: string[]

Tile URL template array

Path: style.sources.<source-id>.tileSize · Type: integer · Default: 512 · Minimum: 1

Tile size in pixels

Path: style.sources.<source-id>.encoding · Type: "terrarium" | "mapbox" | "custom" · Default: "mapbox"

How elevation is encoded in the tile’s RGB channels

Path: style.sources.<source-id>.minzoom · Type: number · Range: 0 to 24

Minimum zoom level

Path: style.sources.<source-id>.maxzoom · Type: number · Range: 0 to 24

Maximum zoom level

Path: style.sources.<source-id>.bounds · Type: [number, number, number, number]

Bounding box [west, south, east, north]

Path: style.sources.<source-id>.attribution · Type: string

Attribution text

Path: style.sources.<source-id>.volatile · Type: boolean

Skip the tile cache (MapLibre volatile); for frequently changing tiles

Path: style.sources.<source-id>.runtime · Type: object

Per-source live-data configuration

Same shape as style.sources.<source-id>.runtime (type: vector).

Path: style.sources.<source-id>.type · Type: "image" · Required

Source type

Path: style.sources.<source-id>.url · Type: string · Required · Pattern: ^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/|\.\.?\/)

Image URL

Path: style.sources.<source-id>.coordinates · Type: [[number, number], [number, number], [number, number], [number, number]] · Required

Four corner coordinates [topLeft, topRight, bottomRight, bottomLeft]

Path: style.sources.<source-id>.runtime · Type: object

Per-source live-data configuration

Same shape as style.sources.<source-id>.runtime (type: vector).

Path: style.sources.<source-id>.type · Type: "video" · Required

Source type

Path: style.sources.<source-id>.urls · Type: string[] · Required · Min items: 1

Array of video URLs for browser compatibility

Path: style.sources.<source-id>.coordinates · Type: [[number, number], [number, number], [number, number], [number, number]] · Required

Four corner coordinates [topLeft, topRight, bottomRight, bottomLeft]

Path: style.sources.<source-id>.runtime · Type: object

Per-source live-data configuration

Same shape as style.sources.<source-id>.runtime (type: vector).

Path: style.layers · Type: object[] · Default: []

Map layers, each with an optional nested runtime:

One of 10 variants, selected by type: circle, line, fill, symbol, raster, fill-extrusion, heatmap, hillshade, color-relief, background.

Accepted by every variant that lists them below.

Path: style.layers[].id · Type: string · Required

Unique layer identifier

Path: style.layers[].label · Type: string

Human-readable layer label

Path: style.layers[].source · Type: string | object

Layer source: a named-source string ref, or an inline v2 source (nested runtime:, strict RFC 7946 data)

Object form: same shape as style.sources.<source-id>.

Path: style.layers[].source-layer · Type: string

Source layer name (for vector sources)

Path: style.layers[].minzoom · Type: number · Range: 0 to 24

Minimum zoom level to show layer

Path: style.layers[].maxzoom · Type: number · Range: 0 to 24

Maximum zoom level to show layer

Path: style.layers[].filter · Type: array

MapLibre filter expression

Path: style.layers[].visible · Type: boolean · Default: true

Initial visibility state

Path: style.layers[].toggleable · Type: boolean · Default: true

Allow users to toggle visibility

Path: style.layers[].before · Type: string

Layer ID to insert this layer before

Path: style.layers[].interactive · Type: object

Interactive event configuration

Same shape as layers[].interactive.

Path: style.layers[].legend · Type: object

Legend configuration

Same shape as layers[].legend.

Path: style.layers[].effect · Type: object

Experimental: a registered shader effect (type + flat params) that enhances this layer; the layer itself is the static fallback

Same shape as layers[].effect.

Path: style.layers[].metadata · Type: map of any

Custom metadata

Path: style.layers[].runtime · Type: object

Per-layer experience configuration

Path: style.layers[].runtime.interactive · Type: object

Interactive event configuration

Same shape as layers[].interactive.

Path: style.layers[].runtime.legend · Type: object

Legend entry for this layer

Same shape as layers[].legend.

Path: style.layers[].runtime.label · Type: string

Human-readable layer label

Path: style.layers[].runtime.toggleable · Type: boolean

Allow users to toggle visibility

Path: style.layers[].runtime.effect · Type: object

Experimental: a registered shader effect (type + flat params) that enhances this layer; the layer itself is the static fallback

Same shape as layers[].effect.

Path: style.layers[].extends · Type: any

Reserved — layer inheritance (v2). The key name is claimed; the semantics are not defined and the value is unread.

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "circle" · Required

Layer type

Path: style.layers[].paint · Type: object

Circle paint properties

Same shape as layers[].paint (type: circle).

Path: style.layers[].layout · Type: object

Circle layout properties

Any other MapLibre layout property valid for this layer type is accepted as well; the MapLibre style spec is the reference for each property’s semantics.

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "line" · Required

Layer type

Path: style.layers[].paint · Type: object

Line paint properties

Same shape as layers[].paint (type: line).

Path: style.layers[].layout · Type: object

Line layout properties

Same shape as layers[].layout (type: line).

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "fill" · Required

Layer type

Path: style.layers[].paint · Type: object

Fill paint properties

Same shape as layers[].paint (type: fill).

Path: style.layers[].layout · Type: object

Fill layout properties

Same shape as layers[].layout (type: fill).

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "symbol" · Required

Layer type

Path: style.layers[].layout · Type: object

Symbol layout properties

Same shape as layers[].layout (type: symbol).

Path: style.layers[].paint · Type: object

Symbol paint properties

Same shape as layers[].paint (type: symbol).

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "raster" · Required

Layer type

Path: style.layers[].paint · Type: object

Raster paint properties

Same shape as layers[].paint (type: raster).

Path: style.layers[].layout · Type: object

Raster layout properties

Any other MapLibre layout property valid for this layer type is accepted as well; the MapLibre style spec is the reference for each property’s semantics.

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "fill-extrusion" · Required

Layer type

Path: style.layers[].paint · Type: object

Fill extrusion paint properties

Same shape as layers[].paint (type: fill-extrusion).

Path: style.layers[].layout · Type: object

Fill extrusion layout properties

Any other MapLibre layout property valid for this layer type is accepted as well; the MapLibre style spec is the reference for each property’s semantics.

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "heatmap" · Required

Layer type

Path: style.layers[].paint · Type: object

Heatmap paint properties

Same shape as layers[].paint (type: heatmap).

Path: style.layers[].layout · Type: object

Heatmap layout properties

Any other MapLibre layout property valid for this layer type is accepted as well; the MapLibre style spec is the reference for each property’s semantics.

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "hillshade" · Required

Layer type

Path: style.layers[].paint · Type: object

Hillshade paint properties

Same shape as layers[].paint (type: hillshade).

Path: style.layers[].layout · Type: object

Hillshade layout properties

Any other MapLibre layout property valid for this layer type is accepted as well; the MapLibre style spec is the reference for each property’s semantics.

Common fields: id, label, source, source-layer, minzoom, maxzoom, filter, visible, toggleable, before, interactive, legend, effect, metadata, runtime, extends.

Path: style.layers[].type · Type: "color-relief" · Required

Layer type (maplibre-gl >= 5.6)

Path: style.layers[].paint · Type: object

Color-relief paint properties

Same shape as layers[].paint (type: color-relief).

Path: style.layers[].layout · Type: object

Color-relief layout properties

Any other MapLibre layout property valid for this layer type is accepted as well; the MapLibre style spec is the reference for each property’s semantics.

Common fields: runtime, extends, source.

Path: style.layers[].id · Type: string · Required

Unique layer identifier

Path: style.layers[].type · Type: "background" · Required

Layer type

Path: style.layers[].paint · Type: object

Background paint properties

Same shape as layers[].paint (type: background).

Path: style.layers[].layout · Type: object

Background layout properties

Any other MapLibre layout property valid for this layer type is accepted as well; the MapLibre style spec is the reference for each property’s semantics.

Path: style.layers[].metadata · Type: map of any

Custom metadata

Type: object · Default: {}

The runtime half

Path: runtime.map · Type: object · Default: {}

MapLibre Map constructor options

Path: runtime.map.interactive · Type: boolean · Default: true

Enable map interaction

Path: runtime.controls · Type: object

Map controls

Same shape as controls.

Path: runtime.legend · Type: object

Legend configuration

Same shape as legend.

Path: runtime.parameters · Type: map of object

Presentation metadata for state keys — label, type, range

Same shape as parameters.

Path: runtime.markers · Type: object[]

Standalone markers — DOM pins live, symbol layers + sprite on export

Same shape as markers.

Path: runtime.fitTo · Type: object

Fit the initial camera to a GeoJSON source’s data (v1: config.fitTo)

Same shape as config.fitTo.

Path: runtime.popups · Type: object[]

Standalone popups open at a coordinate — no layer, no marker

Same shape as popups.

Path: runtime.container · Type: object

Map container presentation (v2 home of v1’s style:/className:)

Path: runtime.container.style · Type: string

Inline CSS styles for the map container

Path: runtime.container.className · Type: string

CSS class name for the map container

Type: map of object

Runtime-tunable values (may live here or under style:)

Same shape as state.

Type: map of object

Presentation metadata for state keys (may live here or under runtime:)

Same shape as parameters.