Skip to content

Layers

An entry of a block’s layers: list: either a full layer (the type key selects the variant) or a $ref to a named layer in a root document. For narrative and examples see Layer Types and Interactivity.

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: layers[].id · Type: string · Required

Unique layer identifier

Path: layers[].label · Type: string

Human-readable layer label

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

Layer source: inline definition, { $ref: ’#/sources/name’ } reference, or named-source string

See the Sources reference.

Source reference

Path: layers[].source.$ref · Type: string · Required

Reference to a root-level source (e.g., ”#/sources/name”)

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

Source layer name (for vector sources)

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

Minimum zoom level to show layer

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

Maximum zoom level to show layer

Path: layers[].filter · Type: array

MapLibre filter expression

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

Initial visibility state

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

Allow users to toggle visibility

Path: layers[].before · Type: string

Layer ID to insert this layer before

Path: layers[].interactive · Type: object

Interactive event configuration

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

Hover behavior

Path: layers[].interactive.hover.cursor · Type: string

CSS cursor style (e.g., “pointer”)

Path: layers[].interactive.hover.highlight · Type: boolean

Highlight feature on hover

Path: layers[].interactive.hover.emit · Type: object

Dispatch a named host event with a declarative payload once per feature entered on hover (per-feature dedupe, not per mousemove)

Path: layers[].interactive.hover.emit.event · Type: string · Required

Named event dispatched to the host handler map

Path: layers[].interactive.hover.emit.payload · Type: map of object

Declarative payload: named keys projected from feature properties

Path: layers[].interactive.hover.emit.payload.<key> · Type: object

Declarative payload projection item

Path: layers[].interactive.hover.emit.payload.<key>.property · Type: string

Feature property name to project

Path: layers[].interactive.hover.emit.payload.<key>.else · Type: string

Fallback value when the property is missing

Path: layers[].interactive.hover.emit.payload.<key>.str · Type: string

Static literal value

Path: layers[].interactive.hover.popup · Type: (map of object[])[]

Popup shown while hovering a feature (no close button; dismissed on leave). A pinned click popup suppresses hover popups until it is dismissed. Touch has no hover: tap uses click.popup.

Path: layers[].interactive.hover.popup[].<tag> · Type: object[]

Path: layers[].interactive.hover.popup[].<tag>[].str · Type: string | object

Static text; an !html-tagged value carries raw markup

Path: layers[].interactive.hover.popup[].<tag>[].str.$html · Type: string · Required

Path: layers[].interactive.hover.popup[].<tag>[].property · Type: string

Feature property name

Path: layers[].interactive.hover.popup[].<tag>[].else · Type: string

Fallback value if property missing

Path: layers[].interactive.hover.popup[].<tag>[].format · Type: string

Number format string (e.g., “,.0f”)

Path: layers[].interactive.hover.popup[].<tag>[].href · Type: string (URL)

Link URL

Path: layers[].interactive.hover.popup[].<tag>[].text · Type: string

Link text

Path: layers[].interactive.hover.popup[].<tag>[].src · Type: string (URL)

Image/iframe source

Path: layers[].interactive.hover.popup[].<tag>[].alt · Type: string

Image alt text

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

Click behavior

Path: layers[].interactive.click.popup · Type: (map of object[])[]

Popup content to display

Same shape as layers[].interactive.hover.popup.

Path: layers[].interactive.click.action · Type: string · Deprecated

Custom action name to trigger

Path: layers[].interactive.click.flyTo · Type: object

Fly to location on click

Path: layers[].interactive.click.flyTo.center · Type: [number, number]

Target center [longitude, latitude]; defaults to the clicked point

Path: layers[].interactive.click.flyTo.zoom · Type: number · Range: 0 to 24

Target zoom level; MapLibre keeps the current zoom when unset

Path: layers[].interactive.click.flyTo.duration · Type: number

Animation duration in milliseconds; MapLibre’s default when unset

Path: layers[].interactive.click.zoomToFeature · Type: object

Fit the camera to the clicked feature’s own bounds on click

Path: layers[].interactive.click.zoomToFeature.padding · Type: number

Padding in pixels around the fitted bounds

Path: layers[].interactive.click.zoomToFeature.maxZoom · Type: number · Range: 0 to 24

Maximum zoom level when fitting the feature’s bounds

Path: layers[].interactive.click.zoomToFeature.duration · Type: number

Animation duration in milliseconds

Path: layers[].interactive.click.emit · Type: object

Dispatch a named host event with a declarative payload on click

Same shape as layers[].interactive.hover.emit.

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

Legacy mouse-enter trigger. Its only key, action, is deprecated and never dispatched; use hover or listen for ml-map:layer-hover

Path: layers[].interactive.mouseenter.action · Type: string · Deprecated

Custom action on mouse enter

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

Legacy mouse-leave trigger. Its only key, action, is deprecated and never dispatched; use hover or listen for ml-map:layer-hover

Path: layers[].interactive.mouseleave.action · Type: string · Deprecated

Custom action on mouse leave

Path: layers[].legend · Type: object

Legend configuration

Path: layers[].legend.color · Type: string · Required

CSS color value

Path: layers[].legend.label · Type: string · Required

Legend label text

Path: layers[].legend.shape · Type: "circle" | "square" | "line" | "icon" · Default: "square"

Symbol shape

Path: layers[].legend.icon · Type: string

Icon name or URL (for shape: icon)

Path: layers[].effect · Type: object

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

Path: layers[].effect.type · Type: string · Required · Min length: 1

A registered effect type, e.g. tonal-hatch or blueprint

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

Custom metadata

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

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

Layer type

Path: layers[].paint · Type: object

Circle paint properties

PropertyTypeNotes
circle-radiusnumber | arrayNumber value or MapLibre expression
circle-colorstring | arrayColor value or MapLibre expression
circle-blurnumber | arrayNumber value or MapLibre expression
circle-opacitynumber | arrayNumber value or MapLibre expression
circle-stroke-widthnumber | arrayNumber value or MapLibre expression
circle-stroke-colorstring | arrayColor value or MapLibre expression
circle-stroke-opacitynumber | arrayNumber value or MapLibre expression
circle-pitch-scale"map" | "viewport"One of map, viewport.
circle-pitch-alignment"map" | "viewport"One of map, viewport.
circle-translate[number, number]
circle-translate-anchor"map" | "viewport"One of map, viewport.

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

Path: 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.

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

Layer type

Path: layers[].paint · Type: object

Line paint properties

PropertyTypeNotes
line-opacitynumber | arrayNumber value or MapLibre expression
line-colorstring | arrayColor value or MapLibre expression
line-widthnumber | arrayNumber value or MapLibre expression
line-gap-widthnumber | arrayNumber value or MapLibre expression
line-offsetnumber | arrayNumber value or MapLibre expression
line-blurnumber | arrayNumber value or MapLibre expression
line-dasharraynumber[]
line-patternstring | array
line-gradientstring | arrayColor value or MapLibre expression
line-translate[number, number]
line-translate-anchor"map" | "viewport"One of map, viewport.

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

Path: layers[].layout · Type: object

Line layout properties

PropertyTypeNotes
line-cap"butt" | "round" | "square"One of butt, round, square.
line-join"bevel" | "round" | "miter"One of bevel, round, miter.
line-miter-limitnumber
line-round-limitnumber
line-sort-keynumber | arrayNumber value or MapLibre expression

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.

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

Layer type

Path: layers[].paint · Type: object

Fill paint properties

PropertyTypeNotes
fill-antialiasboolean
fill-opacitynumber | arrayNumber value or MapLibre expression
fill-colorstring | arrayColor value or MapLibre expression
fill-outline-colorstring | arrayColor value or MapLibre expression
fill-translate[number, number]
fill-translate-anchor"map" | "viewport"One of map, viewport.
fill-patternstring | array

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

Path: layers[].layout · Type: object

Fill layout properties

PropertyTypeNotes
fill-sort-keynumber | arrayNumber value or MapLibre expression

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.

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

Layer type

Path: layers[].layout · Type: object

Symbol layout properties

PropertyTypeNotes
symbol-placement"point" | "line" | "line-center"One of point, line, line-center.
symbol-spacingnumber
symbol-avoid-edgesboolean
symbol-sort-keynumber | arrayNumber value or MapLibre expression
symbol-z-order"auto" | "viewport-y" | "source"One of auto, viewport-y, source.
icon-allow-overlapboolean
icon-ignore-placementboolean
icon-optionalboolean
icon-rotation-alignment"map" | "viewport" | "auto"One of map, viewport, auto.
icon-sizenumber | arrayNumber value or MapLibre expression
icon-text-fit"none" | "width" | "height" | "both"One of none, width, height, both.
icon-text-fit-padding[number, number, number, number]
icon-imagestring | array
icon-rotatenumber | arrayNumber value or MapLibre expression
icon-paddingnumber
icon-keep-uprightboolean
icon-offset[number, number]
icon-anchorstringOne of center, left, right, top, bottom, top-left, top-right, bottom-left, bottom-right.
icon-pitch-alignment"map" | "viewport" | "auto"One of map, viewport, auto.
text-pitch-alignment"map" | "viewport" | "auto"One of map, viewport, auto.
text-rotation-alignment"map" | "viewport" | "auto"One of map, viewport, auto.
text-fieldstring | array
text-fontstring[]
text-sizenumber | arrayNumber value or MapLibre expression
text-max-widthnumber | arrayNumber value or MapLibre expression
text-line-heightnumber
text-letter-spacingnumber
text-justify"auto" | "left" | "center" | "right"One of auto, left, center, right.
text-radial-offsetnumber
text-variable-anchorstring[]
text-anchorstringOne of center, left, right, top, bottom, top-left, top-right, bottom-left, bottom-right.
text-max-anglenumber
text-rotatenumber | arrayNumber value or MapLibre expression
text-paddingnumber
text-keep-uprightboolean
text-transform"none" | "uppercase" | "lowercase"One of none, uppercase, lowercase.
text-offset[number, number]
text-allow-overlapboolean
text-ignore-placementboolean
text-optionalboolean

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: layers[].paint · Type: object

Symbol paint properties

PropertyTypeNotes
icon-opacitynumber | arrayNumber value or MapLibre expression
icon-colorstring | arrayColor value or MapLibre expression
icon-halo-colorstring | arrayColor value or MapLibre expression
icon-halo-widthnumber | arrayNumber value or MapLibre expression
icon-halo-blurnumber | arrayNumber value or MapLibre expression
icon-translate[number, number]
icon-translate-anchor"map" | "viewport"One of map, viewport.
text-opacitynumber | arrayNumber value or MapLibre expression
text-colorstring | arrayColor value or MapLibre expression
text-halo-colorstring | arrayColor value or MapLibre expression
text-halo-widthnumber | arrayNumber value or MapLibre expression
text-halo-blurnumber | arrayNumber value or MapLibre expression
text-translate[number, number]
text-translate-anchor"map" | "viewport"One of map, viewport.

Any other MapLibre paint 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.

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

Layer type

Path: layers[].paint · Type: object

Raster paint properties

PropertyTypeNotes
raster-opacitynumber | arrayNumber value or MapLibre expression
raster-hue-rotatenumber | arrayNumber value or MapLibre expression
raster-brightness-minnumber | arrayNumber value or MapLibre expression
raster-brightness-maxnumber | arrayNumber value or MapLibre expression
raster-saturationnumber | arrayNumber value or MapLibre expression
raster-contrastnumber | arrayNumber value or MapLibre expression
raster-resampling"linear" | "nearest"One of linear, nearest.
raster-fade-durationnumber

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

Path: 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.

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

Layer type

Path: layers[].paint · Type: object

Fill extrusion paint properties

PropertyTypeNotes
fill-extrusion-opacitynumber | arrayNumber value or MapLibre expression
fill-extrusion-colorstring | arrayColor value or MapLibre expression
fill-extrusion-translate[number, number]
fill-extrusion-translate-anchor"map" | "viewport"One of map, viewport.
fill-extrusion-patternstring | array
fill-extrusion-heightnumber | arrayNumber value or MapLibre expression
fill-extrusion-basenumber | arrayNumber value or MapLibre expression
fill-extrusion-vertical-gradientboolean

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

Path: 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.

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

Layer type

Path: layers[].paint · Type: object

Heatmap paint properties

PropertyTypeNotes
heatmap-radiusnumber | arrayNumber value or MapLibre expression
heatmap-weightnumber | arrayNumber value or MapLibre expression
heatmap-intensitynumber | arrayNumber value or MapLibre expression
heatmap-colorstring | arrayColor value or MapLibre expression
heatmap-opacitynumber | arrayNumber value or MapLibre expression

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

Path: 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.

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

Layer type

Path: layers[].paint · Type: object

Hillshade paint properties

PropertyTypeNotes
hillshade-illumination-directionnumber | number[] | arrayA number, one number per light (multidirectional), or an expression
hillshade-illumination-altitudenumber | number[] | arrayA number, one number per light (multidirectional), or an expression
hillshade-illumination-anchor"map" | "viewport"One of map, viewport.
hillshade-method"standard" | "basic" | "combined" | "igor" | "multidirectional"One of standard, basic, combined, igor, multidirectional.
hillshade-exaggerationnumber | arrayNumber value or MapLibre expression
hillshade-shadow-colorstring | string[] | arrayA color, one color per light (multidirectional), or an expression
hillshade-highlight-colorstring | string[] | arrayA color, one color per light (multidirectional), or an expression
hillshade-accent-colorstring | arrayColor value or MapLibre expression

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

Path: 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.

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

Layer type (maplibre-gl >= 5.6)

Path: layers[].paint · Type: object

Color-relief paint properties

PropertyTypeNotes
color-relief-colorstring | arrayColor ramp over [“elevation”] — an interpolate/step expression
color-relief-opacitynumber | arrayLayer opacity (0-1)

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

Path: 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.

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

Unique layer identifier

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

Layer type

Path: layers[].paint · Type: object

Background paint properties

PropertyTypeNotes
background-colorstring | arrayColor value or MapLibre expression
background-patternstring | array
background-opacitynumber | arrayNumber value or MapLibre expression

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

Path: 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: layers[].metadata · Type: map of any

Custom metadata

Layer reference

Path: layers[].$ref · Type: string · Required

Reference to global layer (e.g., ”#/layers/bikeLayer”)