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.
Common fields
Section titled “Common fields”Accepted by every variant that lists them below.
format
Section titled “format”Path: sources.<source-id>.format · Type: "pmtiles" | "flatgeobuf" | "geoparquet" | "cog"
File format, when the URL doesn’t show it (pmtiles, flatgeobuf, geoparquet, cog)
loading
Section titled “loading”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
enabled
Section titled “enabled”Path: sources.<source-id>.loading.enabled · Type: boolean · Default: false
No effect (deprecated)
message
Section titled “message”Path: sources.<source-id>.loading.message · Type: string
No effect (deprecated)
showErrorOverlay
Section titled “showErrorOverlay”Path: sources.<source-id>.loading.showErrorOverlay · Type: boolean · Default: true
No effect (deprecated)
Path: sources.<source-id>.cache · Type: object
Cache configuration
enabled
Section titled “enabled”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)
type: geojson
Section titled “type: geojson”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)
minzoom
Section titled “minzoom”Path: sources.<source-id>.load.minzoom · Type: number · Range: 0 to 24
viewport: read nothing below this zoom (default 10)
maxFeatures
Section titled “maxFeatures”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)
overviews
Section titled “overviews”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)
columns
Section titled “columns”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
prefetchedData
Section titled “prefetchedData”Path: sources.<source-id>.prefetchedData · Type: any
Pre-fetched data from build time
fetchStrategy
Section titled “fetchStrategy”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
stream
Section titled “stream”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
reconnect
Section titled “reconnect”Path: sources.<source-id>.stream.reconnect · Type: boolean · Default: true
Automatically reconnect on disconnect
reconnectMaxAttempts
Section titled “reconnectMaxAttempts”Path: sources.<source-id>.stream.reconnectMaxAttempts · Type: number · Default: 10 · Minimum: 0
Maximum number of reconnection attempts
reconnectDelay
Section titled “reconnectDelay”Path: sources.<source-id>.stream.reconnectDelay · Type: number · Default: 1000 · Minimum: 100
Initial delay in milliseconds before reconnecting
reconnectMaxDelay
Section titled “reconnectMaxDelay”Path: sources.<source-id>.stream.reconnectMaxDelay · Type: number · Default: 30000 · Minimum: 1000
Maximum delay in milliseconds for exponential backoff
eventTypes
Section titled “eventTypes”Path: sources.<source-id>.stream.eventTypes · Type: string[]
Event types to listen for (SSE only)
protocols
Section titled “protocols”Path: sources.<source-id>.stream.protocols · Type: string | string[]
WebSocket sub-protocols (WebSocket only)
refresh
Section titled “refresh”Path: sources.<source-id>.refresh · Type: object
Polling refresh configuration
refreshInterval
Section titled “refreshInterval”Path: sources.<source-id>.refresh.refreshInterval · Type: number · Minimum: 1000
Polling interval in milliseconds (minimum 1000ms)
updateStrategy
Section titled “updateStrategy”Path: sources.<source-id>.refresh.updateStrategy · Type: "replace" | "merge" | "append-window" · Default: "replace"
How to merge incoming data with existing data
updateKey
Section titled “updateKey”Path: sources.<source-id>.refresh.updateKey · Type: string
Property key for merge strategy (required for merge)
windowSize
Section titled “windowSize”Path: sources.<source-id>.refresh.windowSize · Type: number · Greater than: 0
Maximum features to keep (append-window)
windowDuration
Section titled “windowDuration”Path: sources.<source-id>.refresh.windowDuration · Type: number · Greater than: 0
Maximum age in milliseconds (append-window)
timestampField
Section titled “timestampField”Path: sources.<source-id>.refresh.timestampField · Type: string
Property field containing timestamp (append-window)
refreshInterval
Section titled “refreshInterval”Path: sources.<source-id>.refreshInterval · Type: number · Minimum: 1000 · Deprecated
Deprecated: use refresh.refreshInterval. Polling interval in milliseconds
updateStrategy
Section titled “updateStrategy”Path: sources.<source-id>.updateStrategy · Type: "replace" | "merge" | "append-window" · Deprecated
Deprecated: use refresh.updateStrategy
updateKey
Section titled “updateKey”Path: sources.<source-id>.updateKey · Type: string · Deprecated
Deprecated: use refresh.updateKey
cluster
Section titled “cluster”Path: sources.<source-id>.cluster · Type: boolean
Enable point clustering
clusterRadius
Section titled “clusterRadius”Path: sources.<source-id>.clusterRadius · Type: integer · Minimum: 0
Cluster radius in pixels (default: 50)
clusterMaxZoom
Section titled “clusterMaxZoom”Path: sources.<source-id>.clusterMaxZoom · Type: number · Range: 0 to 24
Maximum zoom level to cluster points
clusterMinPoints
Section titled “clusterMinPoints”Path: sources.<source-id>.clusterMinPoints · Type: integer · Minimum: 2
Minimum points to form a cluster
clusterProperties
Section titled “clusterProperties”Path: sources.<source-id>.clusterProperties · Type: map of any
Aggregate cluster properties
tolerance
Section titled “tolerance”Path: sources.<source-id>.tolerance · Type: number
Douglas-Peucker simplification tolerance (higher = simpler geometry)
buffer
Section titled “buffer”Path: sources.<source-id>.buffer · Type: number
Tile buffer size on each side, in pixels at tile scale
lineMetrics
Section titled “lineMetrics”Path: sources.<source-id>.lineMetrics · Type: boolean
Calculate line distance metrics (required for line-gradient)
generateId
Section titled “generateId”Path: sources.<source-id>.generateId · Type: boolean
Assign feature ids from each feature’s index (enables feature-state)
promoteId
Section titled “promoteId”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
attribution
Section titled “attribution”Path: sources.<source-id>.attribution · Type: string
Attribution text
type: vector
Section titled “type: vector”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
minzoom
Section titled “minzoom”Path: sources.<source-id>.minzoom · Type: number · Range: 0 to 24
Minimum zoom level
maxzoom
Section titled “maxzoom”Path: sources.<source-id>.maxzoom · Type: number · Range: 0 to 24
Maximum zoom level
bounds
Section titled “bounds”Path: sources.<source-id>.bounds · Type: [number, number, number, number]
Bounding box [west, south, east, north]
scheme
Section titled “scheme”Path: sources.<source-id>.scheme · Type: "xyz" | "tms"
Tile coordinate scheme
attribution
Section titled “attribution”Path: sources.<source-id>.attribution · Type: string
Attribution text
promoteId
Section titled “promoteId”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
volatile
Section titled “volatile”Path: sources.<source-id>.volatile · Type: boolean
Skip the tile cache (MapLibre volatile); for frequently changing tiles
encoding
Section titled “encoding”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
type: raster
Section titled “type: raster”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://)
colorRamp
Section titled “colorRamp”Path: sources.<source-id>.colorRamp · Type: object
COG: colours for a single band of values (palette or colors, min, max)
palette
Section titled “palette”Path: sources.<source-id>.colorRamp.palette · Type: string
Palette name, as in classify: (viridis, cividis, YlGn, RdBu …); default viridis
colors
Section titled “colors”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
reverse
Section titled “reverse”Path: sources.<source-id>.colorRamp.reverse · Type: boolean
Run the colours high to low
classes
Section titled “classes”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
tileSize
Section titled “tileSize”Path: sources.<source-id>.tileSize · Type: integer · Default: 512 · Minimum: 1
Tile size in pixels
minzoom
Section titled “minzoom”Path: sources.<source-id>.minzoom · Type: number · Range: 0 to 24
Minimum zoom level
maxzoom
Section titled “maxzoom”Path: sources.<source-id>.maxzoom · Type: number · Range: 0 to 24
Maximum zoom level
bounds
Section titled “bounds”Path: sources.<source-id>.bounds · Type: [number, number, number, number]
Bounding box [west, south, east, north]
scheme
Section titled “scheme”Path: sources.<source-id>.scheme · Type: "xyz" | "tms"
Tile coordinate scheme
attribution
Section titled “attribution”Path: sources.<source-id>.attribution · Type: string
Attribution text
volatile
Section titled “volatile”Path: sources.<source-id>.volatile · Type: boolean
Skip the tile cache (MapLibre volatile); for frequently changing tiles
type: raster-dem
Section titled “type: raster-dem”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
tileSize
Section titled “tileSize”Path: sources.<source-id>.tileSize · Type: integer · Default: 512 · Minimum: 1
Tile size in pixels
encoding
Section titled “encoding”Path: sources.<source-id>.encoding · Type: "terrarium" | "mapbox" | "custom" · Default: "mapbox"
How elevation is encoded in the tile’s RGB channels
minzoom
Section titled “minzoom”Path: sources.<source-id>.minzoom · Type: number · Range: 0 to 24
Minimum zoom level
maxzoom
Section titled “maxzoom”Path: sources.<source-id>.maxzoom · Type: number · Range: 0 to 24
Maximum zoom level
bounds
Section titled “bounds”Path: sources.<source-id>.bounds · Type: [number, number, number, number]
Bounding box [west, south, east, north]
attribution
Section titled “attribution”Path: sources.<source-id>.attribution · Type: string
Attribution text
volatile
Section titled “volatile”Path: sources.<source-id>.volatile · Type: boolean
Skip the tile cache (MapLibre volatile); for frequently changing tiles
type: image
Section titled “type: image”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
coordinates
Section titled “coordinates”Path: sources.<source-id>.coordinates · Type: [[number, number], [number, number], [number, number], [number, number]] · Required
Four corner coordinates [topLeft, topRight, bottomRight, bottomLeft]
type: video
Section titled “type: video”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
coordinates
Section titled “coordinates”Path: sources.<source-id>.coordinates · Type: [[number, number], [number, number], [number, number], [number, number]] · Required
Four corner coordinates [topLeft, topRight, bottomRight, bottomLeft]
type: grid
Section titled “type: grid”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)
encoding
Section titled “encoding”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)
bounds
Section titled “bounds”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 …)
nodata
Section titled “nodata”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
channel
Section titled “channel”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
equals
Section titled “equals”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)
attribution
Section titled “attribution”Path: sources.<source-id>.attribution · Type: string
Attribution text for the data