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.

1
{
2
"version": 13.12.0,
3
"name": "NB Maptile",
4
"sprite": "https://api.nextbillion.io/maps/streets/sprite",
5
"glyphs": "https://api.nextbillion.io/fonts/{fontstack}/{range}.pbf",
6
"sources": {...},
7
"layers": [...]
8
}

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).

1
"bearing": 29

center

Optional Array<number>.

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).

1
"center": [ -73.9749, 40.7736 ]

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.

1
"glyphs":"https://api.nextbillion.io/fonts/{fontstack}/{range}.pbf"

layers

Required layer.

Layers will be drawn in the order of this array.

1
"layers": [ { "id": "water", "source": "nb-streets",
2
"source-layer": "water", "type": "fill", "paint": { "fill-color":
3
"#00ffff" } } ]

light

Optional light.

The global light source.

1
"light": { "anchor": "viewport", "color": "white", "intensity": 0.4 }

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.

1
"name": "Bright"

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

1
"sources": { "nb-streets": { "type": "vector", "url": "https://api.example.com/nb-streets.json" } }

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.

1
"sprite": "https://api.nextbillion.io/maps/streets/sprite"

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.

1
"transition": { "duration": 300, "delay": 0 }

version

Required string.

Style specification version number. Must always be 8.

1
"version": 8

version

Required string.

Style specification version number. Must always be 8.

1
"version": 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).

1
"zoom": 12.5

© 2024 NextBillion.ai all rights reserved.