Root
Root level properties of a Nextbillion.ai style specify the map's layers, tile sources and other resources, and default values for the initial camera position when not specified elsewhere.
Let’s take a look at the attributes available at root level:
bearing
Optional number. Default: "0"
Default bearing, in degrees. The bearing is the compass direction that is "up"; for example, a bearing of 90° orients the map so that east is up. This value will be used only if the map has not been positioned by other means (e.g. map options or user interaction).
center
Default map centre expressed as [longitude, latitude]. The style centre will be used only if the map has not been positioned by other means (e.g. map options or user interaction).
glyphs
Optional string.
A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include {fontstack}
and {range}
tokens. This property is required if any layer uses the text-field
layout property. The URL must be absolute, containing the scheme, authority and pathcomponents.
layers
Required layer.
Layers will be drawn in the order of this array.
light
Optional light.
The global light source.
metadata
Optional object.
Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'nb:'.
name
Optional string.
A custom name for the style.
pitch
Optional number. Default: 50
Default pitch, in degrees. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60° looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).
sources
Required sources.
Data source specifications. See sources for more details
sprite
Optional string.
A base URL for retrieving the sprite image and metadata. The extensions .png
, .json
and scale factor @2x.png
will be automatically appended. This property is required if any layer uses the background-pattern
, fill-pattern
, line-pattern
, fill-extrusion-pattern
, or icon-image
properties. The URL must be absolute, containing the scheme, authority and pathcomponents.
transition
Optional transition.
A global transition definition to use as a default across properties, to be used for timing transitions between one value and the next when no property-specific transition is set. Collision-based symbol fading is controlled independently of the style's transition property.
version
Required string.
Style specification version number. Must always be 8.
version
Required string.
Style specification version number. Must always be 8.
zoom
Optional string_.
Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).