Skip to content

Sources

A data source, declared under a block’s sources: map (then referenced from a layer by bare name) or inline as a layer’s source:. The type key selects the variant. For narrative and examples see Loading data and Sources & layers.

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

Accepted by every variant that lists them below.

Path: sources.<source-id>.format · Type: "pmtiles" | "flatgeobuf" | "geoparquet" | "cog"

File format, when the URL doesn’t show it (pmtiles, flatgeobuf, geoparquet, cog)

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

Deprecated, no effect: no per-source loading overlay is drawn. The map shows “Loading map…” while it starts

Path: sources.<source-id>.loading.enabled · Type: boolean · Default: false

No effect (deprecated)

Path: sources.<source-id>.loading.message · Type: string

No effect (deprecated)

Path: sources.<source-id>.loading.showErrorOverlay · Type: boolean · Default: true

No effect (deprecated)

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

Cache configuration

Path: sources.<source-id>.cache.enabled · Type: boolean · Default: true

Enable HTTP caching

Path: sources.<source-id>.cache.ttl · Type: number · Greater than: 0

Cache TTL in milliseconds (overrides default)

Common fields: format, loading, cache.

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

Source type

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

URL of a GeoJSON file, or of a FlatGeobuf (.fgb) or GeoParquet (.parquet) file

Path: sources.<source-id>.load · Type: "all" | "viewport" | object

FlatGeobuf/GeoParquet: read the whole file (all, default) or only the features in view (viewport)

Allowed values: all, viewport

Path: sources.<source-id>.load.mode · Type: "all" | "viewport"

all (whole file, the default) or viewport (features in view)

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

viewport: read nothing below this zoom (default 10)

Path: sources.<source-id>.load.maxFeatures · Type: integer · Minimum: 1

The most features one read takes: a view holding more isn’t read (default 150000; the map asks to zoom in), and above 400000 it also raises the whole-file limit (heavier on memory)

Path: sources.<source-id>.load.overviews · Type: boolean

Experimental. GeoParquet overview files (geo:overviews) read by view: draw the level that fits the zoom (true, the default) or only the full-detail level (false)

Path: sources.<source-id>.columns · Type: "all" | string[]

GeoParquet: the columns to read (default: the ones this document references), or all

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

Inline GeoJSON object

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

Pre-fetched data from build time

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

No effect (deprecated): data is always fetched in the browser when the map loads. build and hybrid warn and do nothing

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

WebSocket/SSE streaming configuration

Path: sources.<source-id>.stream.type · Type: "websocket" | "sse" · Required

Streaming connection type

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

WebSocket or SSE endpoint URL

Path: sources.<source-id>.stream.reconnect · Type: boolean · Default: true

Automatically reconnect on disconnect

Path: sources.<source-id>.stream.reconnectMaxAttempts · Type: number · Default: 10 · Minimum: 0

Maximum number of reconnection attempts

Path: sources.<source-id>.stream.reconnectDelay · Type: number · Default: 1000 · Minimum: 100

Initial delay in milliseconds before reconnecting

Path: sources.<source-id>.stream.reconnectMaxDelay · Type: number · Default: 30000 · Minimum: 1000

Maximum delay in milliseconds for exponential backoff

Path: sources.<source-id>.stream.eventTypes · Type: string[]

Event types to listen for (SSE only)

Path: sources.<source-id>.stream.protocols · Type: string | string[]

WebSocket sub-protocols (WebSocket only)

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

Polling refresh configuration

Path: sources.<source-id>.refresh.refreshInterval · Type: number · Minimum: 1000

Polling interval in milliseconds (minimum 1000ms)

Path: sources.<source-id>.refresh.updateStrategy · Type: "replace" | "merge" | "append-window" · Default: "replace"

How to merge incoming data with existing data

Path: sources.<source-id>.refresh.updateKey · Type: string

Property key for merge strategy (required for merge)

Path: sources.<source-id>.refresh.windowSize · Type: number · Greater than: 0

Maximum features to keep (append-window)

Path: sources.<source-id>.refresh.windowDuration · Type: number · Greater than: 0

Maximum age in milliseconds (append-window)

Path: sources.<source-id>.refresh.timestampField · Type: string

Property field containing timestamp (append-window)

Path: sources.<source-id>.refreshInterval · Type: number · Minimum: 1000 · Deprecated

Deprecated: use refresh.refreshInterval. Polling interval in milliseconds

Path: sources.<source-id>.updateStrategy · Type: "replace" | "merge" | "append-window" · Deprecated

Deprecated: use refresh.updateStrategy

Path: sources.<source-id>.updateKey · Type: string · Deprecated

Deprecated: use refresh.updateKey

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

Enable point clustering

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

Cluster radius in pixels (default: 50)

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

Maximum zoom level to cluster points

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

Minimum points to form a cluster

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

Aggregate cluster properties

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

Douglas-Peucker simplification tolerance (higher = simpler geometry)

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

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

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

Calculate line distance metrics (required for line-gradient)

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

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

Path: 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: sources.<source-id>.attribution · Type: string

Attribution text

Common fields: format.

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

Source type

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

TileJSON URL, or a PMTiles archive (.pmtiles or pmtiles://)

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

Tile URL template array

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

Minimum zoom level

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

Maximum zoom level

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

Bounding box [west, south, east, north]

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

Tile coordinate scheme

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

Attribution text

Path: 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: sources.<source-id>.volatile · Type: boolean

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

Path: sources.<source-id>.encoding · Type: "mvt" | "mlt"

The tiles’ format: mvt (Mapbox Vector Tiles, the default) or mlt (MapLibre Tiles, maplibre-gl 6+). A PMTiles archive whose header says MLT gets mlt without it; a value written here wins

Common fields: format.

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

Source type

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

TileJSON URL, a PMTiles archive (.pmtiles or pmtiles://), or a COG (.tif or cog://)

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

COG: colours for a single band of values (palette or colors, min, max)

Path: sources.<source-id>.colorRamp.palette · Type: string

Palette name, as in classify: (viridis, cividis, YlGn, RdBu …); default viridis

Path: sources.<source-id>.colorRamp.colors · Type: string[] · Min items: 2

Your own colours, low to high (#rrggbb), instead of a palette

Path: sources.<source-id>.colorRamp.min · Type: number · Required

The value drawn in the first colour

Path: sources.<source-id>.colorRamp.max · Type: number · Required

The value drawn in the last colour

Path: sources.<source-id>.colorRamp.reverse · Type: boolean

Run the colours high to low

Path: sources.<source-id>.colorRamp.classes · Type: integer · Minimum: 2

Draw this many flat classes instead of a smooth ramp (with colors:, spread along them)

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

Tile URL template array

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

Tile size in pixels

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

Minimum zoom level

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

Maximum zoom level

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

Bounding box [west, south, east, north]

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

Tile coordinate scheme

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

Attribution text

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

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

Common fields: format.

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

Source type

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

TileJSON URL, a PMTiles archive (.pmtiles or pmtiles://), or an elevation COG (.tif or cog://)

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

Tile URL template array

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

Tile size in pixels

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

How elevation is encoded in the tile’s RGB channels

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

Minimum zoom level

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

Maximum zoom level

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

Bounding box [west, south, east, north]

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

Attribution text

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

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

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

Source type

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

Image URL

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

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

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

Source type

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

Array of video URLs for browser compatibility

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

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

Common fields: loading, cache.

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

Source type

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

URL of the grid file (an image, a JSON header, or a GeoTIFF)

Path: sources.<source-id>.encoding · Type: "rg-uv" | "scalar-r" | "nullschool-json" | "geotiff" · Required

How values are packed: rg-uv (two components in the red and green bytes), scalar-r (one value in the red byte), nullschool-json (header plus data arrays), geotiff (one or two bands)

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

Cell edges as [west, south, east, north], for an image encoding (or use grid:)

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

Node geometry, for an image encoding (or use bounds:)

Path: sources.<source-id>.grid.nx · Type: number · Required

Columns (nodes along a row)

Path: sources.<source-id>.grid.ny · Type: number · Required

Rows

Path: sources.<source-id>.grid.lo1 · Type: number · Required

Longitude of the first node (centre of node 0, 0)

Path: sources.<source-id>.grid.la1 · Type: number · Required

Latitude of the first node (the top row)

Path: sources.<source-id>.grid.dx · Type: number · Required

Spacing between columns in degrees, eastward; positive

Path: sources.<source-id>.grid.dy · Type: number · Required

Spacing between rows in degrees, southward from la1; positive

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

[lo, hi]: the values bytes 0 and 255 stand for (rg-uv and scalar-r only)

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

Unit of the values, as a label (K, m/s, m …)

Path: sources.<source-id>.nodata · Type: number | object

Which nodes carry no value: { channel, below | above | equals } for an image encoding, a number for geotiff

Path: sources.<source-id>.nodata.channel · Type: "r" | "g" | "b" | "a" · Required

The channel the rule reads

Path: sources.<source-id>.nodata.below · Type: number

A node is missing when the byte is below this

Path: sources.<source-id>.nodata.above · Type: number

A node is missing when the byte is above this

Path: sources.<source-id>.nodata.equals · Type: number

A node is missing when the byte equals this

Path: sources.<source-id>.bands · Type: number[]

GeoTIFF band indices to read: [value] or [u, v] (geotiff only)

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

Attribution text for the data