Map Style Specification
Purpose
Map style is written in JSON format. It specifies how to:
- Style the symbols, lines, polygons, background, hills' shades, heatmap points, raster tiles, circles, and extruded polygons.
- Which of them should be drawn.
- The order in which to draw them.
Root Properties
Root level properties define Default values, tile sources, and the map's layers.
Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | none | Name of the style. |
number | yes | none | Version of the style specification. Value: |
number | no | none | Default zoom level. Only applies if the map has not been positioned by any other means (e.g., user interaction). |
number (degrees) | no | 0 | Default bearing. For instance, 90o sets east as the up direction. Only applies if the map has not been positioned by any other means (e.g., user interaction). |
array of numbers | no | none | Default map center. The array shall consist of two values: longitude and latitude. They can be either integer or floating point numbers. Only applies if the map has not been positioned by any other means (e.g., user interaction). |
number (degrees) | no | 0 | Default pitch. The view is straight down at the map when the value is 0. Greater values set the view towards the horizon. Only applies if the map has not be positioned by any other means (e.g., user interaction). |
object | yes | none | Data source. Properties of the |
object | no | none | Light source. Properties of the |
object | no / | none | The URL must contain the scheme, authority, path, and the {fontstack} and {range} tokens. The property will be used to load glyphs in PBF format. |
object | no | none | Defines the default transition to use across the style. Properties of
the |
array of objects | yes | none | The array of layers. Layers will be drawn in the same order as they appear in this property. |
string | no / | none | The URL must contain a scheme, authority, and path. The property is used to load the sprite image. The file extension for the sprite image (.png) and metadata (.json) will be added automatically. |
Source Properties
A source provides data that is displayed on the map.
- The
source
object needs to have a property namedtype
. - There are several types of source:
vector
,raster
,raster-dem
(Web SDK only),geojson
,image
,video
(Web SDK Only). - Each of them have different properties which are described below.
Vector Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | none | URL to a resource. |
array of strings | no | none | An array of the URLs to a resource. This property can contain one or more URLs. |
string | no | none | Attribution that is shown when the map is displayed. |
string | no | xyz | Scheme of the data. |
array of numbers | no |
| An array of the longitude and latitude pairs containing southwest and northeast corners. No tiles will be requested outside of those bounds. |
number | no | 0 | Minimum zoom level the tiles are available for. |
number | no | 22 | Maximum zoom level the tiles are available for. |
Raster Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | none | URL to a resource. |
array of strings | no | none | An array of the URLs to a resource. This property can contain one or more URLs. |
string | no | none | Attribution that is shown when the map is displayed. |
string | no | xyz | Scheme of the data. Values:
|
array of numbers | no |
| An array of the longitude and latitude pairs containing southwest and northeast corners. No tiles will be requested outside of those bounds. |
number | no | 0 | Minimum zoom level the tiles are available for. |
number | no | 22 | Maximum zoom level the tiles are available for. |
number (pixels) | no | 512 | Minimum size to display tiles. |
Raster-Dem Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | none | URL to a resource. |
array of strings | no | none | An array of the URLs to a resource. This property can contain one or more URLs. |
string | no | none | Attribution that is shown when the map is displayed. |
string | no | mapbox | Encoding used by source. Values:
|
array of numbers | no |
| An array of the longitude and latitude pairs containing southwest and northeast corners. No tiles will be requested outside of those bounds. |
number | no | 0 | Minimum zoom level the tiles are available for. |
number | no | 22 | Maximum zoom level the tiles are available for. |
number (pixels) | no | 512 | Minimum size to display tiles. |
GeoJSON Properties
Name | Required | Default value | Description |
---|---|---|---|
string | yes | none | URL to a GeoJSON resource or inline GeoJSON. |
number | no | 128 | Size of the tile buffer.
|
string | no | none | Attribution that is shown when the map is displayed. |
number | no | 0.375 | Tolerance of Douglas-Peucker simplification. Lower values result in more detailed geometries and slower performance. |
boolean | no | false | If
|
number | no | 50 | Radius to group points into clusters. Number must be equal to or greater
than |
number | no |
| Maximum zoom level to group points into clusters. |
object | no | none | Allows the definition of custom properties for generated clusters, combining values from clustered points. Syntax:
|
number | no | 18 | Maximum zoom level to create the tiles. |
boolean | no | false |
|
boolean | no | false |
|
Image Properties
Name | Required | Default value | Description |
---|---|---|---|
string | yes | none | URL to an image resource. |
array of arrays of numbers | yes | none | Corners of an image specified in
|
Video Properties
Name | Required | Default value | Description |
---|---|---|---|
array of strings | yes | none | URLs to video resources. |
array of arrays of numbers | yes | none | Corners of a video specified in
|
SDK Support
Source Type | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✘ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✘ |
Sprite property
The sprite property provides the URL to load images used in the rendering process. Properties which use sprite are:
icon-image
fill-extrusion-pattern
line-pattern
fill-pattern
background-pattern
A sprite source must contain index and image files.
Index file
The Index file must be written in JSON format and contain a JSON object. The keys of the root object are identifiers to be used in style properties.
1{2 "145": {3 "width": 24,4 "height": 24,5 "x": 697,6 "y": 600,7 "pixelRatio": 18 }9}
Name | Description |
---|---|
number | Width of the image. |
number | Height of the image. |
number | Horizontal location of the image. |
number | Vertical location of the image. |
array of numbers | Pixel ratio of the image. |
Sprite file
The Sprite file contains PNG images.
Glyphs Property
The URL template is used to load glyphs in PBF format.
Example
http://localhost:6001/glyphs/{fontstack}/{range}.pbf
Token Name | Description |
---|---|
| The token is replaced with requested glyphs from the text-font layout property. |
| The token is replaced with Unicode code points. Ranges are calculated at runtime. |
Transition Properties
Defines timing for the interpolation between the style's property values. It can be set globally for the style, but also configured per layer.
Properties
Name | Required | Default value | Description |
---|---|---|---|
*number (milliseconds)* | no | 300 | Time needed to complete transitions. Value needs to be equal to or greater than 0. |
*number (milliseconds)* | no | 0 | Time before a transition starts. |
SDK Support
Property Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
Light Properties
Defines the light source for the style.
Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | viewport | Anchor of the source light. Values:
|
number | no | 0.5 | Intensity of the lighting. Value must be between |
color | no | #ffffff | Color of the light source for extruded geometries. |
array of numbers | no |
| Position of the light source which is relative to extruded geometries.
|
SDK Support
Property Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
Layer Properties
Layer defines how specific features retrieved from a source are rendered on the map. The renderer decides how to draw a feature based on its properties and the style of the layer that describes it. Only the background type layer does not need a source property.
Properties
Name | Required | Default value | Description |
---|---|---|---|
string | yes | none | ID of the layer. Must be unique. |
string | yes | none | Type of the layer. Values:
|
object | no | none | Attributes that do not affect rendering. |
string | no / yes (if | none | Name of a source to be used. |
string | no / yes (if | none | A layer to use from vector source. |
number | no | none | The minimum zoom level to draw the layer. Number must be between
|
number | no | none | The maximum zoom level to draw the layer. Number must be between
|
*array (filter)* | no | none | If the feature does not match the condition, then it is not drawn on the map. |
object | no | none | Layout properties. Properties of the |
object | no | none | Paint properties. Properties of the |
Layout Properties
Background Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
Fill Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
Line Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
string | no | butt | Type of the line's endings. Values:
|
string | no | miter | Type of the line's join. Values:
|
number | no | 2 | Used to convert miter joins to bevel ones for sharp angles. |
number | no | 1.05 | Used to convert round joins to miter ones for shallow angles. |
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
Symbol Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
number | no | none | Used to sort features. Features are drawn in ascending order. |
string | no | auto | Type of sorting features. Affects the order of overlapping features within the same layer are being rendered. Values:
|
string | no | point | Placement of the label. Values:
|
*number (pixels)* | no | 250 | Distance between symbol anchors. |
boolean | no | false | The symbol will not be drawn when it crosses tile edge if this property
is set to |
boolean | no | false | The icon will be drawn even if a collision is detected with other
already drawn icons. |
boolean | no | false | Other symbols will be visible even if a collision is detected with the
icon. |
boolean | no | false | Only text will be drawn if the icon collides with other symbols. |
string | no | auto | Sets icon rotation alignment. Values:
|
number | no | 1 | Scales the icon image size by multiplying its original size by this
property. |
string | no | none | Scales the icon to fit the text. Values:
|
array of numbers | no |
| Padding around the area defined by
|
string | no | none | Name of an image in the sprite config file. |
*number (degrees)* | no | 0 | Icon is rotated clockwise by this property. |
*number (pixels)* | no | 2 | Extra area surrounding an icon to detect collisions with other symbols.
|
boolean | no | false | Prevents an icon from being rendered upside-down.
|
*array of numbers (pixels)* | no |
| An icon's distance from its anchor. Each element of the array is
multiplied by the value of
|
string | no | center | Sets which part of the icon is closest to the anchor.
Values:
|
string | no | auto | Orientation of the icon when a map is pitched. Values:
|
string | no | auto | Orientation of the text when a map is pitched. Values:
|
string | no | auto | Sets text rotation alignment. Values:
|
string | no | none | Text to be displayed as a symbol label. |
array of strings | no |
| Font to be used to display text. |
*number (pixels)* | no | 16 | Text size. |
*number (ems)* | no | 10 | Maximum width of the text. |
*number (ems)* | no | 1.2 | Text leading value for multi-line text. |
*number (ems)* | no | 0 | Sets spacing between letters. |
string | no | center | Justifies the text. Values:
|
*number (ems)* | no | 0 | Radial offset of the text in the direction of the symbol's anchor.
|
array of strings | no | none | Sets the position of the text. The render will try to place the label
using the values provided in the array.
|
string | no | center | Sets the position of the text. The render will try to place the label
using the values provided in the array. Values:
|
*number (degrees)* | no | 45 | Maximum angle change between adjacent characters.
|
*number (degrees)* | no | 0 | Rotates the text clockwise. |
*number (pixels)* | no | 2 | Extra area surrounding text for detecting collisions with other symbols.
|
boolean | no | true | Prevents text from being rendered upside-down. |
string | no | none | Capitalizes text. Values:
|
*array of numbers (ems)* | no |
| Text distance from its anchor.
|
boolean | no | false | The text will be drawn even if a collision is detected with other
already drawn icons. |
boolean | no | false | Other symbols will be visible even if a collision is detected with the
text. |
boolean | no | false | Only an icon will be drawn if the text collides with other symbols.
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
Raster Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
Circle Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
Fill-Extrusion Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
Heatmap Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
Hillshade Properties
Name | Required | Default value | Description |
---|---|---|---|
string | no | visible | Visibility of the layer. Values:
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
string | ✔ / ✖ | ✔ / ✖ |
Paint Properties
Background Properties
Name | Required | Default value | Description |
---|---|---|---|
color | no | #000000 | Background's color. It has no effect if |
string | no | none | Name of a sprite image to use. |
number | no | 1 | Opacity of the background. Number must be between |
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
Fill Properties
Name | Required | Default value | Description |
---|---|---|---|
boolean | no | true | If |
number | no | 1 | Opacity of the fill. Number must be between |
color | no | #000000 | Fill's color. It has no effect if |
string | no | none | The outline color of the fill.
|
*array of numbers (pixels)* | no |
| The geometry's offset.
|
string | no | map | Defines what Values:
|
string | no | none | Name of a sprite image to use as a fill. |
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
Line Properties
Name | Required | Default value | Description |
---|---|---|---|
number | no | 1 | Opacity of the line. Number must be between |
color | no | #000000 | Line's color. It has no effect if |
*array of numbers (pixels)* | no |
| The geometry's offset.
|
string | no | map | Defines what Values:
|
string | no | none | Name of a sprite image to draw the line. |
*number (pixels)* | no | 1 | Line's thickness. Number must be greater than or equal to |
*number (pixels)* | no | 0 | Width of the inner gap. |
*number (pixels)* | no | 0 | The line's offset.
|
*number (pixels)* | no | 0 | Blur applied to the line. |
*array of numbers (line widths)* | no | none | Defines lengths of the dashes and gaps. The lengths are scaled by the
|
string | no | none | Defines a gradient to color the line.
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
Symbol Properties
Name | Required | Default value | Description |
---|---|---|---|
number | no | 1 | Opacity of the icon.
|
color | no | #000000 | Icon's color. |
*array of numbers (pixels)* | no |
| An icon's anchor is moved from its original placement.
|
string | no | map | Defines what Values:
|
color | no | rgba(0, 0, 0, 0) | Icon's halo color. |
*number (pixels)* | no | 0 | Icon's halo width. |
*number (pixels)* | no | 0 | Fades out the halo.
|
number | no | 1 | Opacity of the text.
|
color | no | #000000 | Text's color. |
color | no | rgba(0, 0, 0, 0) | Text's halo color. |
*number (pixels)* | no | 0 | Text's halo width.
|
*number (pixels)* | no | none | Text's halo blur.
|
*array of numbers (pixels)* | no |
| The text's anchor is moved from its original placement.
|
string | no | map | Defines what Values:
|
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
Raster Properties
Name | Required | Default value | Description |
---|---|---|---|
number | no | 1 | Opacity of the image. Number must be between |
*number (degrees)* | no | 0 | Rotates hues around the color wheel. |
number | no | 0 | Minimum brightness of the image. Number must be between |
number | no | 1 | Maximum brightness of the image. Number must be between |
number | no | 0 | Sets saturation of the image. Number must be between |
number | no | 0 | Sets contrast of the image. Number must be between |
string | no | linear | Type of the image resampling. Values:
|
*number (milliseconds)* | no | 300 | Fade in duration of a tile. |
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
Circle Properties
Name | Required | Default value | Description |
---|---|---|---|
number | no | 1 | Opacity of the circle. Number must be between |
color | no | #000000 | Color of the circle. |
*array of numbers (pixels)* | no |
| The geometry's offset.
|
string | no | map | Defines what Values:
|
*number (pixels)* | no | 5 | Radius of the circle. Number must be equal to or greater than
|
number | no | 0 | Only the center point of the circle is not blurred when the value of
this property is equal to |
string | no | map | Scaling type when map is pitched. Values:
|
string | no | viewport | Orientation of the circle when map is pitched. Values:
|
*number (pixels)* | no | 0 | Width of the circle's stroke. Number must be equal to or greater than
|
color | no | #000000 | Color of the circle's stroke. |
number | no | 1 | Opacity of the circle's stroke. Number must be between |
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
Fill-Extrusion Properties
Name | Required | Default value | Description |
---|---|---|---|
number | no | 1 | Opacity of the fill extrusion layer. Number must be between
|
color | no | #000000 | Color of the extruded fill.
|
*array of numbers (pixels)* | no |
| The geometry's offset.
|
string | no | map | Defines what Values:
|
string | no | none | Name of a sprite image to draw extruded fills. |
*number (meters)* | no | 0 | The height to extrude this layer. |
*number (meters)* | no | 0 | The height to extrude the base of this layer.
|
boolean | no | true | If |
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✖ / ✖ |
Heatmap Properties
Name | Required | Default value | Description |
---|---|---|---|
*number (pixels)* | no | 30 | Radius of one heatmap point. Number must be equal to or greater than
|
number | no | 1 | The weight of a point.
|
number | no | 1 | Unlike heatmap-weight, defines the intensity of the heatmap globally. |
string | no |
| Defines color of a pixel based on its density value in the heatmap. |
number | no | 1 | Opacity of the heatmap. Number must be between |
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✔ | ✔ / ✔ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
Hillshade Properties
Name | Required | Default value | Description |
---|---|---|---|
*number (degrees)* | no | 335 | The direction of the light source. Number must be between |
string | no | viewport | Light source direction when map is rotated. Values:
|
number | no | 0.5 | Hillshade's intensity. Number must be between |
color | no | #000000 | The shading color of areas that face opposite direction from the light source. |
number | no | #ffffff | The shading color of areas that face towards the light source. |
color | no | #000000 | The shading color of areas like gorges. |
SDK Support
Property Name | Web SDK supported / expression | Mobile SDK supported / expression |
---|---|---|
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
| ✔ / ✖ | ✔ / ✖ |
Types
Color
Color type represents a color. The type is written as a JSON string and can be written in different formats: hex values, predefined names, rgb, rgba, hsl, hsla.
1{2 "text-color": "#f4f4f4",3 "text-color": "green",4 "text-color": "rgb(255, 255, 255)",5 "text-color": "rgba(255, 255, 255, 1)",6 "text-color": "hsl(240, 100%, 58%)",7 "text-color": "hsla(240, 100%, 58%, 1)"8}
Boolean
Boolean type can be set to either true
or false
.
String
String type is a text written in quotes.
Number
Number type is a value that can be an integer or floating point number.
Filter
The syntax described below is deprecated. It is recommended to use Expressions instead, since they have more flexible syntax than the legacy filters. Expressions syntax and legacy filters syntax cannot be mixed.
Existential Filters
They can be used to check if a feature has a specific attribute or not.
["has", key]
: Checks if the feature contains a specified key.["!has", key]
: Checks if the feature does not contain a specified key.
Comparison Filters
They can be used to compare value of feature's attribute.
["==", key, value]
is equal tofeature[key] == value
["!=", key, value]
is equal tofeature[key] != value
[">", key, value]
is equal tofeature[key] > value
[">=", key, value]
is equal tofeature[key] >= value
["<", key, value]
is equal tofeature[key] < value
["<=", key, value]
is equal tofeature[key] <= value
Set Membership Filters
They can be used to compare value of feature's attribute against mutliple values.
["in", key, v0, ..., vn]
: Checks if any of the values (v0, ..., vn) is the same asfeature[key]
.["!in", key, v0, ..., vn]
: Checks if none of the values (v0, ..., vn) is the same asfeature[key]
.
A value must be a number
, boolean
, or string
to compare against the feature's attribute.
Combining Filters
They can be used to combine other filters.
["all", f0, ..., fn]
: All of the filters must betrue
.["any", f0, ..., fn]
: At least one of the filters must betrue
.["none", f0, ..., fn]
: None of the filters must betrue
.
(f0, ..., fn)
is a set of the filters.
Special Keys
There are some special keys.
$type
: The feature's type that can be eitherPoint
, orLineString
, orPolygon
.$id
: The feature's unqiue id.
(f0, ..., fn)
is a set of the filters.
Expressions
Expressions can be used as filters, and for any layout properties and paint properties to define formulas for computing values.
Expressions are JSON arrays where:
- The first element is a
string
which is the name of the expression. - The next elements are arguments to the expression. The arguments can be
string
,number
,boolean
,null
, or another expression.
Expression syntax
[expression_name, argument0, argument1, ..., argumentN]
Expression operators
- Logical operators:
! != < <= == > >=
- Mathematical operators:
- * / % ^ +
- String operators
- Data operators: allow the getting of features' properties
- Camera operators: allow access to properties of the current map view, for example, zoom level
Data expressions
Data expressions allow access to a feature's data and decide how to display it on the map. They can help to differentiate features if they are present in the same layer.
1"text-font": [2 "match",3 ["get", "category"], // get features category4 // if category matches "Large city" or "Capital city" text-font will have '["Noto-Bold"]' value5 "Large city", ["literal", ["Noto-Bold"]],6 "Capital city", ["literal", ["Noto-Bold"]],7 // if category doesnt match any of the above, text-font will use fallback value instead8 ["literal", ["Noto-Regular"]]9]
The above example sets the font based on the name of the category of a feature. It uses a get
expression to get the name of the feature's category, then sets the right font based on the match.
Camera expression
Camera expresssion is every expression which makes use of the zoom
operator.
1"text-size": [2 "interpolate", ["linear"], ["zoom"],3 3, [4 "match",5 ["get", "category"],6 "Country name", 10,7 58 ],9 5, [10 "match",11 ["get", "category"],12 "Country name", 14,13 814 ]15]
In the above example interpolate
is used to define the relation between zoom level and text size basing it on the feature's attribute.
- The example sets
text-size
to 10 pixels when the zoom level is 3 or below, andtext-size
is set to 14 pixels when the zoom level is 5 or above only whencategory
matchesCountry name
. - The value is linearly interpolated between 10 and 14 pixels.
- If a feature's category does not match
Country name
then fallback values are taken into account.
The ["zoom"]
operator may only be used as the input for interpolate
and step
expressions. It can be used in an expression inside the let
expression.
Examples
1[ "step", ["zoom"], ... ]2[ "interpolate", interpolation_type, ["zoom"], ... ]3[ "let", binding_variables, [ "step", ["zoom"], ... ]]4[ "let", binding_variables, [ "interpolate", interpolation_type, ["zoom"], ... ]]
The layout property camera expression is evaluated only on integer levels, while the paint property camera expression is evaluated on every zoom level change.
Composition
Expressions can contain other expressions and operators within themselves. It allows you to decide how to display features based on their attributes and other factors like zoom level.
1"text-size": [2 "interpolate", ["linear"], ["zoom"],3 3, 5,4 5, [5 "match",6 ["get", "category"],7 "Country name", 14,8 89 ]10]
Type system
Expressions are type safe. Each of the them has a specified return type and arguments' types. Types of arguments passed to the expressions are checked by the SDK. For instance, the return type of the filter
property has to be boolean
.
Types can be unknown when using data expressions. The SDK checks if the value's type of the feature's data is valid for a specific property. If it is not, then the Default value will be used instead.
Types can be unknown when using data expressions like:
["<", ["get", "priority"], ["get", "category"]]
To be sure if a feature's data is the right type, type assertion operators should be used, for instance,
["<", ["number", ["get", "priority"]], ["number" ["get", "category"]]]
A failed check means that the property will use the Default value instead.
Conversion between types does not happen automatically. The only exception is where a property expects color
, then the color represented as a string is converted to a color value. If there is a need to convert other types, then type conversion operators have to be used.
Assertion operators
number
string
boolean
array
Type conversion operators
to-number
to-string
to-boolean
to-color
"text-size": ["to-number", ["get", "size"]]
Expression reference
Types: This section describes type conversion operators and operators which can be useful for testing purposes. Most of the time they are not needed, but they can be in the cases described above.
array
Asserts that the input is an array. The size and the type can be also checked if needed. If the assertion fails the expression is aborted.
type
: type of the array. (optional)size
: size of the array. (optional)input
: input value to be checked.
1["array", input]: array23["array",4type: "string" | "number" | "boolean",5input]: array<type>67["array",8type: "string" | "number" | "boolean",9size: number (literal),10input]: array<type, size>
boolean
Asserts that the input is a boolean. If multiple values are provided, they are evaluated in order until one of them passes the check. If the assertion fails the expression is errored.
input
: input value to be checked.fallback
: fallback values to be checked. (optional)
1["boolean", input: value]: boolean23["boolean", input: value, fallback: value, ..., fallback: value]: boolean
collator
Returns collator
which is used for locale-dependent comparisons.
case-sensitive
:true
if comparison should be case-sensitive,false
otherwise.diacritic-sensitive
:true
if comparison should be diacritic-sensitive,false
otherwise.locale
: The IETF language tag. If none is provided, then the default locale is used. If a requested locale is not available, the system-defined fallback locale will be used.
["collator",{ "case-sensitive": boolean, "diacritic-sensitive": boolean, "locale": string}]: collator
format
Returns formatted text to use within text-field
.
input
: string to be formatted.options
: defines how to formatinput
.text-color
: if set, it overrides the roottext-color
paint property.text-font
: if set, it overrides the roottext-font
layout property.font-scale
: scalling factor relative to the roottext-size
layout property.
1["format",2 input1: string, option1: { "font-scale": number, "text-font": array<string>, "text-color": color },3 input2: string, option2: { "font-scale": number, "text-font": array<string> "text-color": color },4 ...,5 inputN: string, optionN: { "font-scale": number, "text-font": array<string>, "text-color": color }]: formatted
literal
Returns a literal array or object value.
1["literal", [...]]: array<T, N>23["literal", {...}]: object
number
Asserts that the input is a number. If multiple values are provided, they are evaluated in order until one of them passes the check. If the assertion fails the expression is errored.
input
: input value to be checked.fallback
: fallback values to be checked. (optional)
["number", input: value]: number["number", input: value, fallback: value, ..., fallback: value]: number
number-format
Returns number
as a string
using specified formatting rules.
input
: input number to be returned as astring
.options
: formatting rules.locale
: locale to use, needs to be BCP 47 langauge tag.currency
: used for currency style formatting, needs to be ISO 4217 code.min-fraction-digits
: minium number of fractional digits to include.max-fraction-digits
: maximum number of fractional digits to include.
object
Asserts that the input is an object. If multiple values are provided, they are evaluated in order until one of them passes the check. If the assertion fails the expression is errored.
input
: input value to be checked.fallback
: fallback values to be checked. (optional)
["object", input: value]: object["object", input: value, fallback: value, ..., fallback: value]: object
string
Asserts that the input is a string
. If multiple values are provided, they are evaluated in order until one of them passes the check. If the assertion fails the expression is errored.
input
: input value to be checked.fallback
: fallback values to be checked. (optional)
["string", input: value]: string</code></pre>["string", input: value, fallback: value, ..., fallback: value]: string
to-boolean
Converts the input value to a boolean. Converted boolean is false
when one of the provided values is an empty string
, false
, NaN
, 0
or null
. Otherwise the converted boolean is true
.
input
: input value to be converted.
["to-boolean", input: value]: boolean
to-color
Converts the input value to a color. If multiple values are provided, they are evaluated in order until one of them is successfully converted. If none of them has been converted, the expression is errored.
input
: input value to be converted.
["to-color", input: value, fallback: value, ..., fallback: value]: color
to-number
Converts the input value to a number
. If the provided input value is either null
or false
the converted number
will be equal to 0
. The algorithm "ToNumber Applied to the String Type" of the ECMAScript Language Specification is used to convert string
into number
. If multiple values are provided, they are evaluated in order until one of them is successfully converted. If none of them has been converted, the expression is errored.
input
: input value to be converted.
["to-number", input: value, fallback: value, ..., fallback: value]: number
to-string
Converts the input value to a string
. Boolean values are converted to either false
or true
. Null value is converted to " "
. For the numbers, the "NumberToString" algorithm of the ECMAScript Language Specification is used for conversion. Color values are converted into rgba(r, g, b, a)
, where r
, g
, b
∈ [0; 255]
, and a
∈ [0; 1]
.
input
: input value to be converted.
["to-string", input: value]: string
typeof
Returns the type of the input values as string
.
input
: input value to be converted.
["typeof", input: value]: string
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✖ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✖ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
Feature data
accumulated
Returns the accumulated value of a cluster property. Can only be used in the clusterProperties
.
["accumulated"]: value
feature-state
Returns the property from the current feature's state. If the requested property is not available, then null
will be returned. To identify features, use their id
attribute which is an integer
or a string
castable to an integer
. The feature's state has to be set programmatically on each future since they are not part of vector tile data or GeoJSON.
property
: property name to get.
["feature-state", property: string]: value
geometry-type
Returns the feature's geometry type as string
.
Values:
Point
MultiPoint
LineString
MultiLineString
Polygon
MultiPolygon
["geometry-type"]: string
id
Returns a feature's id.
["id"]: value
line-progress
Gets the progress along a gradient line.
["line-progress"]: number
properties
Returns a feature's properties.
["properties"]: object
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✖ |
| ✔ | ✖ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
Lookup
at
Returns an item from an array.
pos
: item's position.array
: array from which to get an item.
["at", pos: number, array: array]: item
get
Returns a property value from the feature's properties or provided object. Returns null
if the property is not available.
key
: ifobject
is not provided then it is the name of current feature's property, otherwise it is the name of the key to get from the provided object.object
: an object to get value from. (optional)
["get", key: string]: value["get", key: string, object: object]: value
has
Checks if the current feature's property or provided object's key exists.
key
: ifobject
is not provided then it is the name of current feature's property, otherwise it is the name of the key to get from the provided object.object
: an object to get value from. (optional)
["has", key: string]: boolean["has", key: string, object: object]: boolean
length
Returns the length of a string
or array
.
input
:string
orarray
to check the length.
["length", input: string | array]: number
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
Decision
The following expressions can be used to add conditional logic to the styles.
!
Logical negation.
input
: boolean to negate.
["!", input: boolean]: boolean
!=
Returns true
if inputs are different, false
otherwise. If the types of the input values can be deduced at the parse time and happen to be different, then the comparison will produce an error. If the types of the input values happen to be different at the runtime, then the result will be always false
.
input1
: value to compare.input2
: value to compare.collator
: collator for locale-dependent string comparison (optional).
["!=", input1: value, input2: value]: boolean["!=", input1: value, input2: value, collator: collator]: boolean
<
Returns true
if the first input is less than the second one, false
otherwise. The types of the inputs need both to be strings or numbers. If during runtime or parsing time they happen to be different, comparison will produce an error.
input1
: value to compare.input2
: value to compare.collator
: collator for locale-dependent string comparison (optional).
["<", input1: value, input2: value]: boolean["<", input1: value, input2: value, collator: collator]: boolean
<=
Returns true
if the first input is less than or equal to the second one, false
otherwise. The types of the inputs need both to be strings or numbers. If during runtime or parsing time they happen to be different, comparison will produce an error.
input1
: value to compare.input2
: value to compare.collator
: collator for locale-dependent string comparison (optional).
["<=", input1: value, input2: value]: boolean["<=", input1: value, input2: value, collator: collator]: boolean
==
Returns true
if the inputs are equal, false
otherwise. If the types of the input values can be deduced at the parse time and happen to be different, then the comparison will produce an error. If the types of the input values happen to be different at the runtime, then the result will be always false
.
input1
: value to compare.input2
: value to compare.collator
: collator for locale-dependent string comparison (optional).
["==", input1: value, input2: value]: boolean["==", input1: value, input2: value, collator: collator]: boolean
>
Returns true
if the first input is greater than the second one, false
otherwise. The types of the inputs need both to be strings or numbers. If during runtime or parsing time they happen to be different, comparison will produce an error.
input1
: value to compare.input2
: value to compare.collator
: collator for locale-dependent string comparison (optional).
[">", input1: value, input2: value]: boolean[">", input1: value, input2: value, collator: collator]: boolean
>=
Returns true
if the first input is greater than or equal to the second one, false
otherwise. The types of the inputs need both to be strings or numbers. If during runtime or parsing time they happen to be different, comparison will produce an error.
input1
: value to compare.input2
: value to compare.collator
: collator for locale-dependent string comparison (optional).
[">=", input1: value, input2: value]: boolean[">=", input1: value, input2: value, collator: collator]: boolean
all
Returns true
if all inputs are true
, false
otherwise. If one of the inputs is false
, then the remaining inputs are not checked and the expression returns false
.
input
: input expression.
["all", input1: boolean, input2: boolean, ..., inputN: boolean]: boolean["all", input1: boolean, input2: boolean, ..., inputN: boolean]: boolean
any
Returns true
if any of the inputs is true
, false
otherwise. If one of the inputs is true
, then the remaining inputs are not checked and the expression returns true
.
input
: input expression.
["all", input1: boolean, input2: boolean, ..., inputN: boolean]: boolean["all", input1: boolean, input2: boolean, ..., inputN: boolean]: boolean
case
Returns a value of the first input expression that evaluates to true
.
input
: input expression.output
: value to return when the input evaluates totrue
.fallback
: value to return when none of the inputs expressions evaluates totrue
.
1["case",2 input1: boolean, output1: value,3 input2: boolean, output2: value,4 ...,5 fallback: value]: value
coalesce
Returns the first non-null value.
input
: input expression.
["coalesce", input1: value, input2: value, ..., inputN: value]: value
match
Returns the output
whose label matches the input
. The input
can be any expression. Labels must have unique names. If input
values match no label then fallback
is returned. The label can only be:
- A single literal number or string.
- An array of literals, numbers, or strings. If the input matches any of the values in the array, then
output
is returned.
1["match",2 input: number | string,3 label: number | string | [number, number, ..., number] | [string, string, ..., string], output: value,4 label: number | string | [number, number, ..., number] | [string, string, ..., string], output: value,5 ...6 label: number | string | [number, number, ..., number] | [string, string, ..., string], output: value,7 fallback: value]: value
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
Ramps, scales, curves
interpolate
Interpolates between pairs of the input
and output
values. Stop input
values must be in ascending order.
Interpolate types:
- linear
["linear"]
interpolates linearly between the pair of stops. - exponential:
["exponential", base]
interpolates exponentially between the pair of stops. Highbase
values increase output values more towards the end of the range while low values increase output linearly. - cubic-bezier:
["cubic-bezier", x1, y1, x2, y2]
interpolates using the cubic bezier curve.
1["interpolate",2 interpolation: interpolationType3 input: number,4 stopInput1: number, stopOutput1: number, array<number>, color,5 stopInput2: number, stopOutput2: number, array<number>, color,6 ...7 stopInputN: number, stopOutputN: number, array<number>, color]: number, array<number>, color
interpolate-hcl
Interpolates between pairs of the input
and output
values. Stop input
values must be in ascending order. Interpolation is performed in the Hue-Chroma-Luminance color space.
Interpolate types:
- linear:
["linear"]
interpolates linearly between the pair of stops. - exponential:
["exponential", base]
interpolates exponentially between the pair of stops. Highbase
values increase output values more towards the end of the range while low values increase output linearly. - cubic-bezier:
["cubic-bezier", x1, y1, x2, y2]
interpolates using the cubic bezier curve.
1["interpolate-hcl",2 interpolation: interpolationType3 input: number,4 stopInput1: number, stopOutput1: color,5 stopInput2: number, stopOutput2: color,6 ...7 stopInputN: number, stopOutputN: color]: color
interpolate-lab
Interpolates between pairs of the input
and output
values. Stop input
values must be in ascending order. Interpolation is performed in the CIELAB color space.
Interpolate types:
- linear:
["linear"]
interpolates linearly between the pair of stops. - exponential:
["exponential", base]
interpolates exponentially between the pair of stops. Highbase
values increase output values more towards the end of the range while low values increase output linearly. - cubic-bezier:
["cubic-bezier", x1, y1, x2, y2]
interpolates using the cubic bezier curve.
1["interpolate-lab",2 interpolation: interpolationType3 input: number,4 stopInput1: number, stopOutput1: color,5 stopInput2: number, stopOutput2: color,6 ...7 stopInputN: number, stopOutputN: color]: color
step
Interpolates between pairs of the input
and output
values. Stop input
values must be in ascending order.
1["step",2 input: number,3 stopOutput0: value,4 stopInput1: number, stopOutput1: value,5 stopInput2: number, stopOutput2: value,6 ...7 stopInputN: number, stopOutputN: value]: value
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✖ |
| ✔ | ✖ |
| ✔ | ✔ |
Variable binding
let
Binds expression to variables.
["let", variable: string, any, ..., value]: value
var
References variable bound using "let".
["var", variable: string]: bound expression's type
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
String
concat
Concats pass inputs, converting them to a string
beforehand.
["concat", input1: value, input2: value, ..., inputN: value]: string
downcase
Converts the input string to lowercase.
["downcase", input: string]: string
is-supported-script
Checks if the input renders as it should without losing meaning.
["is-supported-script", input: string]: boolean
resolved-locale
Returns the language tag of the locale used by collator
. It can be used to check if the requested locale has been successfully loaded.
["resolved-locale", input: collator]: string
upcase
Converts the input string to uppercase.
["upcase", input: string]: string
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
Color
rgb
Creates color based on red
, green
, and blue
input values with the alpha component set to 1
. Input colors ∈ [0; 255]
.
["rgb", red: number, green: number, blue: number]: color
rgba
Creates color based on red
, green
, and blue
, and alpha
components. Input colors ∈ [0; 255]
. Alpha component ∈ [0; 1]
.
["rgba", red: number, green: number, blue: number, alpha: number]: color
to-rgba
Returns an array that contains input rgba colors.
["to-rgba", input: color]: array<number, 4>
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
Math
-
Subtracts the second input from the first one. If there is only one input, then the input is subtracted from 0
.
["-", input: number, input: number]: number["-", input: number]: number
*
Returns the product of the passed numbers.
["*", input1: number, input2: number, ..., inputN: number]: number
/
Returns the quotient of the two numbers.
["/", input1: number, input2: number]: number
%
Returns the remainder of the division of the first input by the second one.
["%", input1: number, input2: number]: number
^
Returns the result of raising the input
to the power
.
["^", input: number, power: number]: number
+
Returns the result of raising the input
to the power
.
["+", input1: number, input2: number, ..., inputN: number]: number
sqrt
Returns the square root of the input.
["sqrt", input: number]: number
abs
Returns the absolute value of the input.
["abs", input: number]: number
sin
Returns the sine of the input.
["sin", input: number]: number
cos
Returns the cosine of the input.
["cos", input: number]: number
tan
Returns the tangent of the input.
["tan", input: number]: number
asin
Returns the arcsine of the input.
["asin", input: number]: number
acos
Returns the arccosine of the input.
["acos", input: number]: number
atan
Returns the arctangent of the input.
["atan", input: number]: number
ceil
Returns the smallest integer that is greater than or equal to the input.
["ceil", input: number]: number
e
Returns the mathematical constant e
.
["e"]: number
pi
Returns the mathematical constant π.
["pi"]: number
ln
Returns the natural logarithm of the input.
["ln", input: number]: number
ln2
Returns the mathematical constant ln(2).
["ln2", input: number]: number
log10
Returns the base ten logarithm of the input.
["log10", input: number]: number
log2
Returns the base two logarithm of the input.
["log2", input: number]: number
max
Returns the maximum number of the inputs.
["max", input1: number, input2: number, ..., inputN: number]: number
min
Returns the minimum number of the inputs.
["min", input1: number, input2: number, ..., inputN: number]: number
round
Rounds the input to the nearest integer. Halfway values are rounded away from zero.
["round", input: number]: number
floor
Returns the largest integer that is less than or equal to the input.
["floor", input: number]: number
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
| ✔ | ✔ |
Zoom
zoom
Returns the current zoom level. In the layout and paint properties, the zoom
expression may only be used as an input in the top level step
or interpolate
expression.
["zoom"]: number
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
Heatmap
heatmap-density
Returns estimated density of the center of a pixel in a heatmap layer. This is useful to determine how many data points are crowded around a pixel.
["heatmap-density"]: number
SDK Support
Expression Name | Web SDK | Mobile SDK |
---|---|---|
| ✔ | ✔ |
The TomTom vector map style specification is derived from the Style Specification of Mapbox, which is licensed under the BSD 3-Clause "New" or "Revised" License as described below.
Modifications and additions are © TomTom, and are provided under the same license terms.
_
Mapbox Style Specification
Copyright (c) 2019, Mapbox
_
All rights reserved.
_
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
_
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of Mapbox GL JS nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
_
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.