Layers
Contents
A style’s layers
property lists all the layers available in that style. The type of layer is specified by the type
property, and must be one of background
, fill
, line
, symbol
, raster
, circle
, fill-extrusion
, heatmap
, hillshade
.
Except for layers of the background
type, each layer needs to refer to a source. Layers take the data that they get from a source, optionally filter features, and then define how those features are styled.
layers: [
{
"id": "coastline",
"source": "maps",
"source-layer": "countries",
"type": "line",
"paint": {"line-color": "#198EC8"}
}
]
Layer Properties
id
Required string.
Unique layer name.
type
Required enum. Possible values: fill
, line
, symbol
, circle
, heatmap
, fill-extrusion
, raster
, hillshade
, background
.
Rendering type of this layer.
fill
: A filled polygon with an optional stroked border.line
: A stroked line.symbol
: An icon or a text label.circle
: A filled circle.heatmap
: A heatmap.fill-extrusion
: An extruded (3D) polygon.raster
: Raster map textures such as satellite imagery.hillshade
: Client-side hillshading visualization based on DEM data. The implementation supports Mapbox Terrain RGB, Mapzen Terrarium tiles and custom encodings.background
: The background color or pattern of the map.
metadata
Optional.
Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions:'.
metadata: {"source:comment": "Hydrology FCCODE 460 - Narrow wash"}
source
Optional string.
Name of a source description to be used for this layer. Required for all layer types except background
.
source-layer
Optional string.
Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types, including GeoJSON sources.
minzoom
Optional number in range [0, 24].
The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden.
maxzoom
Optional number in range [0, 24].
The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden.
filter
Optional filter.
A expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The feature-state
expression is not supported in filter expressions.
layout
Optional layout.
Layout properties for the layer.
paint
Optional paint.
Default paint properties for this layer.
Background
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
background-color
Paint property. Optional color. Defaults to #000000
. Disabled by background-pattern
. Supports interpolate expressions. Transitionable.
The color with which the background will be drawn.
background-pattern
Paint property. Optional resolvedImage. Transitionable.
Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, …, 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
background-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports interpolate expressions. Transitionable.
The opacity at which the background will be drawn.
Fill
fill-sort-key
Layout property. Optional number.
Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
fill-antialias
Paint property. Optional boolean. Defaults to true
.
Whether or not the fill should be antialiased.
fill-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports feature-state and interpolate expressions. Transitionable.
The opacity of the entire fill layer. In contrast to the fill-color
, this value will also affect the 1px stroke around the fill, if the stroke is used.
fill-color
Paint property. Optional color. Defaults to #000000
. Disabled by fill-pattern
. Supports feature-state and interpolate expressions. Transitionable.
The color of the filled part of this layer. This color can be specified as rgba
with an alpha component and the color’s opacity will not affect the opacity of the 1px stroke, if it is used.
fill-outline-color
Paint property. Optional color. Disabled by fill-pattern
. Requires fill-antialias
to be true
. Supports feature-state and interpolate expressions. Transitionable.
The outline color of the fill. Matches the value of fill-color
if unspecified.
fill-translate
Paint property. Optional array. Units in pixels. Defaults to 0,0
. Supports interpolate expressions. Transitionable.
The geometry’s offset. Values are [x, y] where negatives indicate left and up, respectively.
fill-translate-anchor
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to map
. Requires fill-translate
.
Controls the frame of reference for fill-translate
.
map
: The fill is translated relative to the map.viewport
: The fill is translated relative to the viewport.
fill-pattern
Paint property. Optional resolvedImage. Transitionable.
Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, …, 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
Circle
circle-sort-key
Layout property. Optional number.
Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
circle-radius
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 5
. Supports feature-state and interpolate expressions. Transitionable.
Circle radius.
circle-color
Paint property. Optional color. Defaults to #000000
. Supports feature-state and interpolate expressions. Transitionable.
The fill color of the circle.
circle-blur
Paint property. Optional number. Defaults to 0
. Supports feature-state and interpolate expressions. Transitionable.
Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.
circle-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports feature-state and interpolate expressions. Transitionable.
The opacity at which the circle will be drawn.
circle-translate
Paint property. Optional array. Units in pixels. Defaults to 0,0
. Supports interpolate expressions. Transitionable.
The geometry’s offset. Values are [x, y] where negatives indicate left and up, respectively.
circle-translate-anchor
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to map
. Requires circle-translate
.
Controls the frame of reference for circle-translate
.
map
: The circle is translated relative to the map.viewport
: The circle is translated relative to the viewport.
circle-pitch-scale
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to map
.
Controls the scaling behavior of the circle when the map is pitched.
map
: Circles are scaled according to their apparent distance to the camera.viewport
: Circles are not scaled.
circle-pitch-alignment
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to viewport
.
Orientation of circle when map is pitched.
map
: The circle is aligned to the plane of the map.viewport
: The circle is aligned to the plane of the viewport.
circle-stroke-width
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 0
. Supports feature-state and interpolate expressions. Transitionable.
The width of the circle’s stroke. Strokes are placed outside of the circle-radius
.
circle-stroke-color
Paint property. Optional color. Defaults to #000000
. Supports feature-state and interpolate expressions. Transitionable.
The stroke color of the circle.
circle-stroke-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports feature-state and interpolate expressions. Transitionable.
The opacity of the circle’s stroke.
Heatmap
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
heatmap-radius
Paint property. Optional number in range [1, ∞). Units in pixels. Defaults to 30
. Supports feature-state and interpolate expressions. Transitionable.
Radius of influence of one heatmap point in pixels. Increasing the value makes the heatmap smoother, but less detailed.
heatmap-weight
Paint property. Optional number in range [0, ∞). Defaults to 1
. Supports feature-state and interpolate expressions.
A measure of how much an individual point contributes to the heatmap. A value of 10 would be equivalent to having 10 points of weight 1 in the same spot. Especially useful when combined with clustering.
heatmap-intensity
Paint property. Optional number in range [0, ∞). Defaults to 1
. Supports interpolate expressions. Transitionable.
Similar to heatmap-weight
but controls the intensity of the heatmap globally. Primarily used for adjusting the heatmap based on zoom level.
heatmap-color
Paint property. Optional color. Defaults to interpolate,linear,heatmap-density,0,rgba(0, 0, 255, 0),0.1,royalblue,0.3,cyan,0.5,lime,0.7,yellow,1,red
. Supports interpolate expressions.
Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses ["heatmap-density"]
as input.
heatmap-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports interpolate expressions. Transitionable.
The global opacity at which the heatmap layer will be drawn.
Fill-extrusion
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
fill-extrusion-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports interpolate expressions. Transitionable.
The opacity of the entire fill extrusion layer. This is rendered on a per-layer, not per-feature, basis, and data-driven styling is not available.
fill-extrusion-color
Paint property. Optional color. Defaults to #000000
. Disabled by fill-extrusion-pattern
. Supports feature-state and interpolate expressions. Transitionable.
The base color of the extruded fill. The extrusion’s surfaces will be shaded differently based on this color in combination with the root light
settings. If this color is specified as rgba
with an alpha component, the alpha component will be ignored; use fill-extrusion-opacity
to set layer opacity.
fill-extrusion-translate
Paint property. Optional array. Units in pixels. Defaults to 0,0
. Supports interpolate expressions. Transitionable.
The geometry’s offset. Values are [x, y] where negatives indicate left and up (on the flat plane), respectively.
fill-extrusion-translate-anchor
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to map
. Requires fill-extrusion-translate
.
Controls the frame of reference for fill-extrusion-translate
.
map
: The fill extrusion is translated relative to the map.viewport
: The fill extrusion is translated relative to the viewport.
fill-extrusion-pattern
Paint property. Optional resolvedImage. Transitionable.
Name of image in sprite to use for drawing images on extruded fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, …, 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
fill-extrusion-height
Paint property. Optional number in range [0, ∞). Units in meters. Defaults to 0
. Supports feature-state and interpolate expressions. Transitionable.
The height with which to extrude this layer.
fill-extrusion-base
Paint property. Optional number in range [0, ∞). Units in meters. Defaults to 0
. Requires fill-extrusion-height
. Supports feature-state and interpolate expressions. Transitionable.
The height with which to extrude the base of this layer. Must be less than or equal to fill-extrusion-height
.
fill-extrusion-vertical-gradient
Paint property. Optional boolean. Defaults to true
.
Whether to apply a vertical gradient to the sides of a fill-extrusion layer. If true, sides will be shaded slightly darker farther down.
Line
line-cap
Layout property. Optional enum. Possible values: butt
, round
, square
. Defaults to butt
.
The display of line endings.
butt
: A cap with a squared-off end which is drawn to the exact endpoint of the line.round
: A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line’s width and centered on the endpoint of the line.square
: A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line’s width.
line-join
Layout property. Optional enum. Possible values: bevel
, round
, miter
. Defaults to miter
.
The display of lines when joining.
bevel
: A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line’s width.round
: A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line’s width and centered on the endpoint of the line.miter
: A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.
line-miter-limit
Layout property. Optional number. Defaults to 2
. Requires line-join
to be miter
. Supports interpolate expressions.
Used to automatically convert miter joins to bevel joins for sharp angles.
line-round-limit
Layout property. Optional number. Defaults to 1.05
. Requires line-join
to be round
. Supports interpolate expressions.
Used to automatically convert round joins to miter joins for shallow angles.
line-sort-key
Layout property. Optional number.
Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
line-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports feature-state and interpolate expressions. Transitionable.
The opacity at which the line will be drawn.
line-color
Paint property. Optional color. Defaults to #000000
. Disabled by line-pattern
. Supports feature-state and interpolate expressions. Transitionable.
The color with which the line will be drawn.
line-translate
Paint property. Optional array. Units in pixels. Defaults to 0,0
. Supports interpolate expressions. Transitionable.
The geometry’s offset. Values are [x, y] where negatives indicate left and up, respectively.
line-translate-anchor
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to map
. Requires line-translate
.
Controls the frame of reference for line-translate
.
map
: The line is translated relative to the map.viewport
: The line is translated relative to the viewport.
line-width
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 1
. Supports feature-state and interpolate expressions. Transitionable.
Stroke thickness.
line-gap-width
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 0
. Supports feature-state and interpolate expressions. Transitionable.
Draws a line casing outside of a line’s actual path. Value indicates the width of the inner gap.
line-offset
Paint property. Optional number. Units in pixels. Defaults to 0
. Supports feature-state and interpolate expressions. Transitionable.
The line’s offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.
line-blur
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 0
. Supports feature-state and interpolate expressions. Transitionable.
Blur applied to the line, in pixels.
line-dasharray
Paint property. Optional array in range [0, ∞). Units in line widths. Disabled by line-pattern
. Transitionable.
Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width. Note that GeoJSON sources with lineMetrics: true
specified won’t render dashed lines to the expected scale. Also note that zoom-dependent expressions will be evaluated only at integer zoom levels.
line-pattern
Paint property. Optional resolvedImage. Transitionable.
Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, …, 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
line-gradient
Paint property. Optional color. Disabled by line-dasharray
. Disabled by line-pattern
. Requires source to be geojson
. Supports interpolate expressions.
Defines a gradient with which to color a line feature. Can only be used with GeoJSON sources that specify "lineMetrics": true
.
Symbol
symbol-placement
Layout property. Optional enum. Possible values: point
, line
, line-center
. Defaults to point
.
Label placement relative to its geometry.
point
: The label is placed at the point where the geometry is located.line
: The label is placed along the line of the geometry. Can only be used onLineString
andPolygon
geometries.line-center
: The label is placed at the center of the line of the geometry. Can only be used onLineString
andPolygon
geometries. Note that a single feature in a vector tile may contain multiple line geometries.
symbol-spacing
Layout property. Optional number in range [1, ∞). Units in pixels. Defaults to 250
. Requires symbol-placement
to be line
. Supports interpolate expressions.
Distance between two symbol anchors.
symbol-avoid-edges
Layout property. Optional boolean. Defaults to false
.
If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don’t have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, enabling this property is not needed to prevent clipped labels at tile boundaries.
symbol-sort-key
Layout property. Optional number.
Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When icon-allow-overlap
or text-allow-overlap
is false
, features with a lower sort key will have priority during placement. When icon-allow-overlap
or text-allow-overlap
is set to true
, features with a higher sort key will overlap over features with a lower sort key.
symbol-z-order
Layout property. Optional enum. Possible values: auto
, viewport-y
, source
. Defaults to auto
.
Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use symbol-sort-key
.
auto
: Sorts symbols bysymbol-sort-key
if set. Otherwise, sorts symbols by their y-position relative to the viewport ificon-allow-overlap
ortext-allow-overlap
is set totrue
oricon-ignore-placement
ortext-ignore-placement
isfalse
.viewport-y
: Sorts symbols by their y-position relative to the viewport ificon-allow-overlap
ortext-allow-overlap
is set totrue
oricon-ignore-placement
ortext-ignore-placement
isfalse
.source
: Sorts symbols bysymbol-sort-key
if set. Otherwise, no sorting is applied; symbols are rendered in the same order as the source data.
icon-allow-overlap
Layout property. Optional boolean. Defaults to false
. Requires icon-image
. Disabled by icon-overlap
.
If true, the icon will be visible even if it collides with other previously drawn symbols.
icon-overlap
Layout property. Optional enum. Possible values: never
, always
, cooperative
. Requires icon-image
.
Allows for control over whether to show an icon when it overlaps other symbols on the map. If icon-overlap
is not set, icon-allow-overlap
is used instead.
never
: The icon will be hidden if it collides with any other previously drawn symbol.always
: The icon will be visible even if it collides with any other previously drawn symbol.cooperative
: If the icon collides with another previously drawn symbol, the overlap mode for that symbol is checked. If the previous symbol was placed usingnever
overlap mode, the new icon is hidden. If the previous symbol was placed usingalways
orcooperative
overlap mode, the new icon is visible.
icon-ignore-placement
Layout property. Optional boolean. Defaults to false
. Requires icon-image
.
If true, other symbols can be visible even if they collide with the icon.
icon-optional
Layout property. Optional boolean. Defaults to false
. Requires icon-image
. Requires text-field
.
If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.
icon-rotation-alignment
Layout property. Optional enum. Possible values: map
, viewport
, auto
. Defaults to auto
. Requires icon-image
.
In combination with symbol-placement
, determines the rotation behavior of icons.
map
: Whensymbol-placement
is set topoint
, aligns icons east-west. Whensymbol-placement
is set toline
orline-center
, aligns icon x-axes with the line.viewport
: Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value ofsymbol-placement
.auto
: Whensymbol-placement
is set topoint
, this is equivalent toviewport
. Whensymbol-placement
is set toline
orline-center
, this is equivalent tomap
.
icon-size
Layout property. Optional number in range [0, ∞). Units in factor of the original icon size. Defaults to 1
. Requires icon-image
. Supports interpolate expressions.
Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by icon-size
. 1 is the original size; 3 triples the size of the image.
icon-text-fit
Layout property. Optional enum. Possible values: none
, width
, height
, both
. Defaults to none
. Requires icon-image
. Requires text-field
.
Scales the icon to fit around the associated text.
none
: The icon is displayed at its intrinsic aspect ratio.width
: The icon is scaled in the x-dimension to fit the width of the text.height
: The icon is scaled in the y-dimension to fit the height of the text.both
: The icon is scaled in both x- and y-dimensions.
icon-text-fit-padding
Layout property. Optional array. Units in pixels. Defaults to 0,0,0,0
. Requires icon-image
. Requires text-field
. Requires icon-text-fit
to be one of both
, width
, height
. Supports interpolate expressions.
Size of the additional area added to dimensions determined by icon-text-fit
, in clockwise order: top, right, bottom, left.
icon-image
Layout property. Optional resolvedImage.
Name of image in sprite to use for drawing an image background.
icon-rotate
Layout property. Optional number. Units in degrees. Defaults to 0
. Requires icon-image
. Supports interpolate expressions.
Rotates the icon clockwise.
icon-padding
Layout property. Optional padding. Units in pixels. Defaults to 2
. Requires icon-image
. Supports interpolate expressions.
Size of additional area round the icon bounding box used for detecting symbol collisions.
icon-keep-upright
Layout property. Optional boolean. Defaults to false
. Requires icon-image
. Requires icon-rotation-alignment
to be map
. Requires symbol-placement
to be one of line
, line-center
.
If true, the icon may be flipped to prevent it from being rendered upside-down.
icon-offset
Layout property. Optional array. Defaults to 0,0
. Requires icon-image
. Supports interpolate expressions.
Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of icon-size
to obtain the final offset in pixels. When combined with icon-rotate
the offset will be as if the rotated direction was up.
icon-anchor
Layout property. Optional enum. Possible values: center
, left
, right
, top
, bottom
, top-left
, top-right
, bottom-left
, bottom-right
. Defaults to center
. Requires icon-image
.
Part of the icon placed closest to the anchor.
center
: The center of the icon is placed closest to the anchor.left
: The left side of the icon is placed closest to the anchor.right
: The right side of the icon is placed closest to the anchor.top
: The top of the icon is placed closest to the anchor.bottom
: The bottom of the icon is placed closest to the anchor.top-left
: The top left corner of the icon is placed closest to the anchor.top-right
: The top right corner of the icon is placed closest to the anchor.bottom-left
: The bottom left corner of the icon is placed closest to the anchor.bottom-right
: The bottom right corner of the icon is placed closest to the anchor.
icon-pitch-alignment
Layout property. Optional enum. Possible values: map
, viewport
, auto
. Defaults to auto
. Requires icon-image
.
Orientation of icon when map is pitched.
map
: The icon is aligned to the plane of the map.viewport
: The icon is aligned to the plane of the viewport.auto
: Automatically matches the value oficon-rotation-alignment
.
text-pitch-alignment
Layout property. Optional enum. Possible values: map
, viewport
, auto
. Defaults to auto
. Requires text-field
.
Orientation of text when map is pitched.
map
: The text is aligned to the plane of the map.viewport
: The text is aligned to the plane of the viewport.auto
: Automatically matches the value oftext-rotation-alignment
.
text-rotation-alignment
Layout property. Optional enum. Possible values: map
, viewport
, viewport-glyph
, auto
. Defaults to auto
. Requires text-field
.
In combination with symbol-placement
, determines the rotation behavior of the individual glyphs forming the text.
map
: Whensymbol-placement
is set topoint
, aligns text east-west. Whensymbol-placement
is set toline
orline-center
, aligns text x-axes with the line.viewport
: Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value ofsymbol-placement
.viewport-glyph
: Whensymbol-placement
is set topoint
, aligns text to the x-axis of the viewport. Whensymbol-placement
is set toline
orline-center
, aligns glyphs to the x-axis of the viewport and places them along the line.auto
: Whensymbol-placement
is set topoint
, this is equivalent toviewport
. Whensymbol-placement
is set toline
orline-center
, this is equivalent tomap
.
text-field
Layout property. Optional formatted. Defaults to ``.
Value to use for a text label. If a plain string
is provided, it will be treated as a formatted
with default/inherited formatting options.
text-font
Layout property. Optional array. Defaults to Open Sans Regular,Arial Unicode MS Regular
. Requires text-field
.
Font stack to use for displaying text.
text-size
Layout property. Optional number in range [0, ∞). Units in pixels. Defaults to 16
. Requires text-field
. Supports interpolate expressions.
Font size.
text-max-width
Layout property. Optional number in range [0, ∞). Units in ems. Defaults to 10
. Requires text-field
. Supports interpolate expressions.
The maximum line width for text wrapping.
text-line-height
Layout property. Optional number. Units in ems. Defaults to 1.2
. Requires text-field
. Supports interpolate expressions.
Text leading value for multi-line text.
text-letter-spacing
Layout property. Optional number. Units in ems. Defaults to 0
. Requires text-field
. Supports interpolate expressions.
Text tracking amount.
text-justify
Layout property. Optional enum. Possible values: auto
, left
, center
, right
. Defaults to center
. Requires text-field
.
Text justification options.
auto
: The text is aligned towards the anchor position.left
: The text is aligned to the left.center
: The text is centered.right
: The text is aligned to the right.
text-radial-offset
Layout property. Optional number. Units in ems. Defaults to 0
. Requires text-field
. Supports interpolate expressions.
Radial offset of text, in the direction of the symbol’s anchor. Useful in combination with text-variable-anchor
, which defaults to using the two-dimensional text-offset
if present.
text-variable-anchor
Layout property. Optional array. Requires text-field
. Requires symbol-placement
to be point
.
To increase the chance of placing high-priority labels on the map, you can provide an array of text-anchor
locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use text-justify: auto
to choose justification based on anchor position. To apply an offset, use the text-radial-offset
or the two-dimensional text-offset
.
text-variable-anchor-offset
Layout property. Optional. Requires text-field
. Requires symbol-placement
to be point
. Supports interpolate expressions.
To increase the chance of placing high-priority labels on the map, you can provide an array of text-anchor
locations, each paired with an offset value. The renderer will attempt to place the label at each location, in order, before moving on to the next location+offset. Use text-justify: auto
to choose justification based on anchor position.
The length of the array must be even, and must alternate between enum and point entries. i.e., each anchor location must be accompanied by a point, and that point defines the offset when the corresponding anchor location is used. Positive offset values indicate right and down, while negative values indicate left and up. Anchor locations may repeat, allowing the renderer to try multiple offsets to try and place a label using the same anchor.
When present, this property takes precedence over text-anchor
, text-variable-anchor
, text-offset
, and text-radial-offset
.
{
"text-variable-anchor-offset": [
"top",
[0, 4],
"left",
[3, 0],
"bottom",
[1, 1]
]
}
When the renderer chooses the top
anchor, [0, 4]
will be used for text-offset
; the text will be shifted down by 4 ems.
When the renderer chooses the left
anchor, [3, 0]
will be used for text-offset
; the text will be shifted right by 3 ems.
text-anchor
Layout property. Optional enum. Possible values: center
, left
, right
, top
, bottom
, top-left
, top-right
, bottom-left
, bottom-right
. Defaults to center
. Requires text-field
. Disabled by text-variable-anchor
.
Part of the text placed closest to the anchor.
center
: The center of the text is placed closest to the anchor.left
: The left side of the text is placed closest to the anchor.right
: The right side of the text is placed closest to the anchor.top
: The top of the text is placed closest to the anchor.bottom
: The bottom of the text is placed closest to the anchor.top-left
: The top left corner of the text is placed closest to the anchor.top-right
: The top right corner of the text is placed closest to the anchor.bottom-left
: The bottom left corner of the text is placed closest to the anchor.bottom-right
: The bottom right corner of the text is placed closest to the anchor.
text-max-angle
Layout property. Optional number. Units in degrees. Defaults to 45
. Requires text-field
. Requires symbol-placement
to be one of line
, line-center
. Supports interpolate expressions.
Maximum angle change between adjacent characters.
text-writing-mode
Layout property. Optional array. Requires text-field
. Requires symbol-placement
to be point
.
The property allows control over a symbol’s orientation. Note that the property values act as a hint, so that a symbol whose language doesn’t support the provided orientation will be laid out in its natural orientation. Example: English point symbol will be rendered horizontally even if array value contains single ‘vertical’ enum value. The order of elements in an array define priority order for the placement of an orientation variant.
text-rotate
Layout property. Optional number. Units in degrees. Defaults to 0
. Requires text-field
. Supports interpolate expressions.
Rotates the text clockwise.
text-padding
Layout property. Optional number in range [0, ∞). Units in pixels. Defaults to 2
. Requires text-field
. Supports interpolate expressions.
Size of the additional area around the text bounding box used for detecting symbol collisions.
text-keep-upright
Layout property. Optional boolean. Defaults to true
. Requires text-field
. Requires text-rotation-alignment
to be map
. Requires symbol-placement
to be one of line
, line-center
.
If true, the text may be flipped vertically to prevent it from being rendered upside-down.
text-transform
Layout property. Optional enum. Possible values: none
, uppercase
, lowercase
. Defaults to none
. Requires text-field
.
Specifies how to capitalize text, similar to the CSS text-transform
property.
none
: The text is not altered.uppercase
: Forces all letters to be displayed in uppercase.lowercase
: Forces all letters to be displayed in lowercase.
text-offset
Layout property. Optional array. Units in ems. Defaults to 0,0
. Requires text-field
. Disabled by text-radial-offset
. Supports interpolate expressions.
Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. If used with text-variable-anchor, input values will be taken as absolute values. Offsets along the x- and y-axis will be applied automatically based on the anchor position.
text-allow-overlap
Layout property. Optional boolean. Defaults to false
. Requires text-field
. Disabled by text-overlap
.
If true, the text will be visible even if it collides with other previously drawn symbols.
text-overlap
Layout property. Optional enum. Possible values: never
, always
, cooperative
. Requires text-field
.
Allows for control over whether to show symbol text when it overlaps other symbols on the map. If text-overlap
is not set, text-allow-overlap
is used instead
never
: The text will be hidden if it collides with any other previously drawn symbol.always
: The text will be visible even if it collides with any other previously drawn symbol.cooperative
: If the text collides with another previously drawn symbol, the overlap mode for that symbol is checked. If the previous symbol was placed usingnever
overlap mode, the new text is hidden. If the previous symbol was placed usingalways
orcooperative
overlap mode, the new text is visible.
text-ignore-placement
Layout property. Optional boolean. Defaults to false
. Requires text-field
.
If true, other symbols can be visible even if they collide with the text.
text-optional
Layout property. Optional boolean. Defaults to false
. Requires text-field
. Requires icon-image
.
If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
icon-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Requires icon-image
. Supports feature-state and interpolate expressions. Transitionable.
The opacity at which the icon will be drawn.
icon-color
Paint property. Optional color. Defaults to #000000
. Requires icon-image
. Supports feature-state and interpolate expressions. Transitionable.
The color of the icon. This can only be used with SDF icons.
icon-halo-color
Paint property. Optional color. Defaults to rgba(0, 0, 0, 0)
. Requires icon-image
. Supports feature-state and interpolate expressions. Transitionable.
The color of the icon’s halo. Icon halos can only be used with SDF icons.
icon-halo-width
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 0
. Requires icon-image
. Supports feature-state and interpolate expressions. Transitionable.
Distance of halo to the icon outline.
The unit is in pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for @2x
sprites, etc.
icon-halo-blur
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 0
. Requires icon-image
. Supports feature-state and interpolate expressions. Transitionable.
Fade out the halo towards the outside.
icon-translate
Paint property. Optional array. Units in pixels. Defaults to 0,0
. Requires icon-image
. Supports interpolate expressions. Transitionable.
Distance that the icon’s anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.
icon-translate-anchor
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to map
. Requires icon-image
. Requires icon-translate
.
Controls the frame of reference for icon-translate
.
map
: Icons are translated relative to the map.viewport
: Icons are translated relative to the viewport.
text-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Requires text-field
. Supports feature-state and interpolate expressions. Transitionable.
The opacity at which the text will be drawn.
text-color
Paint property. Optional color. Defaults to #000000
. Requires text-field
. Supports feature-state and interpolate expressions. Transitionable.
The color with which the text will be drawn.
text-halo-color
Paint property. Optional color. Defaults to rgba(0, 0, 0, 0)
. Requires text-field
. Supports feature-state and interpolate expressions. Transitionable.
The color of the text’s halo, which helps it stand out from backgrounds.
text-halo-width
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 0
. Requires text-field
. Supports feature-state and interpolate expressions. Transitionable.
Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.
text-halo-blur
Paint property. Optional number in range [0, ∞). Units in pixels. Defaults to 0
. Requires text-field
. Supports feature-state and interpolate expressions. Transitionable.
The halo’s fadeout distance towards the outside.
text-translate
Paint property. Optional array. Units in pixels. Defaults to 0,0
. Requires text-field
. Supports interpolate expressions. Transitionable.
Distance that the text’s anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.
text-translate-anchor
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to map
. Requires text-field
. Requires text-translate
.
Controls the frame of reference for text-translate
.
map
: The text is translated relative to the map.viewport
: The text is translated relative to the viewport.
Raster
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
raster-opacity
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports interpolate expressions. Transitionable.
The opacity at which the image will be drawn.
raster-hue-rotate
Paint property. Optional number. Units in degrees. Defaults to 0
. Supports interpolate expressions. Transitionable.
Rotates hues around the color wheel.
raster-brightness-min
Paint property. Optional number in range [0, 1]. Defaults to 0
. Supports interpolate expressions. Transitionable.
Increase or reduce the brightness of the image. The value is the minimum brightness.
raster-brightness-max
Paint property. Optional number in range [0, 1]. Defaults to 1
. Supports interpolate expressions. Transitionable.
Increase or reduce the brightness of the image. The value is the maximum brightness.
raster-saturation
Paint property. Optional number in range [-1, 1]. Defaults to 0
. Supports interpolate expressions. Transitionable.
Increase or reduce the saturation of the image.
raster-contrast
Paint property. Optional number in range [-1, 1]. Defaults to 0
. Supports interpolate expressions. Transitionable.
Increase or reduce the contrast of the image.
raster-resampling
Paint property. Optional enum. Possible values: linear
, nearest
. Defaults to linear
.
The resampling/interpolation method to use for overscaling, also known as texture magnification filter
linear
: (Bi)linear filtering interpolates pixel values using the weighted average of the four closest original source pixels creating a smooth but blurry look when overscalednearest
: Nearest neighbor filtering interpolates pixel values using the nearest original source pixel creating a sharp but pixelated look when overscaled
raster-fade-duration
Paint property. Optional number in range [0, ∞). Units in milliseconds. Defaults to 300
. Supports interpolate expressions.
Fade duration when a new tile is added, or when a video is started or its coordinates are updated.
Hillshade
visibility
Layout property. Optional enum. Possible values: visible
, none
. Defaults to visible
.
Whether this layer is displayed.
visible
: The layer is shown.none
: The layer is not shown.
hillshade-illumination-direction
Paint property. Optional number in range [0, 359]. Defaults to 335
. Supports interpolate expressions.
The direction of the light source used to generate the hillshading with 0 as the top of the viewport if hillshade-illumination-anchor
is set to viewport
and due north if hillshade-illumination-anchor
is set to map
.
hillshade-illumination-anchor
Paint property. Optional enum. Possible values: map
, viewport
. Defaults to viewport
.
Direction of light source when map is rotated.
map
: The hillshade illumination is relative to the north direction.viewport
: The hillshade illumination is relative to the top of the viewport.
hillshade-exaggeration
Paint property. Optional number in range [0, 1]. Defaults to 0.5
. Supports interpolate expressions. Transitionable.
Intensity of the hillshade
hillshade-shadow-color
Paint property. Optional color. Defaults to #000000
. Supports interpolate expressions. Transitionable.
The shading color of areas that face away from the light source.
hillshade-highlight-color
Paint property. Optional color. Defaults to #FFFFFF
. Supports interpolate expressions. Transitionable.
The shading color of areas that faces towards the light source.
hillshade-accent-color
Paint property. Optional color. Defaults to #000000
. Supports interpolate expressions. Transitionable.
The shading color used to accentuate rugged terrain like sharp cliffs and gorges.