logo
Style Spec

Root

Root level properties of a MapLibre style specify the map's layers, tile sources and other resources, and default values for the initial camera position when not specified elsewhere.

{
    "version": 8,
    "name": "MapLibre Demo Tiles",
    "sprite": "https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprite",
    "glyphs": "https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",
    "sources": {... },
    "layers": [...]
}

bearing

Optional number. Units in degrees. Defaults to 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).

"bearing": 29

center

Optional array of numbers.

Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).

"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 path components.

"glyphs": "https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"

layers

Required array of layers.

Layers will be drawn in the order of this array.

"layers": [
  {
    "id": "coastline",
    "source": "maplibre",
    "source-layer": "contries",
    "type": "line",
    "paint": {
      "line-color": "#198EC8"
    }
  }
]

light

Optional light.

The global light source.

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

metadata

Optional.

Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'maplibre:'.

"metadata": {
  "styleeditor:slimmode": true,
  "styleeditor:comment": "Style generated 1677776383",
  "styleeditor:version": "3.14.159265",
  "example:object": {
    "String": "one",
    "Number": 2,
    "Boolean": false
  }
}

name

Optional string.

A human-readable name for the style.

"name": "Bright"

pitch

Optional number. Units in degrees. Defaults to 0.

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

"pitch": 50

sky

Optional sky.

The map's sky configuration.

"sky": {
  "sky-color": "#199EF3",
  "fog-color": "#00ff00",
  "horizon-blend": 0.5,
  "fog-blend": 0.6
}

sources

Required object with source values.

Data source specifications.

"sources": {
  "maplibre-demotiles": {
    "type": "vector",
    "url": "https://demotiles.maplibre.org/tiles/tiles.json"
  }
}

sprite

Optional sprite.

An array of {id: 'my-sprite', url: 'https://example.com/sprite'} objects. Each object should represent a unique URL to load a sprite from and and a unique ID to use as a prefix when referencing images from that sprite (i.e. 'my-sprite:image'). All the URLs are internally extended to load both .json and .png files. If the id field is equal to 'default', the prefix is omitted (just 'image' instead of 'default:image'). All the IDs and URLs must be unique. For backwards compatibility, instead of an array, one can also provide a single string that represent a URL to load the sprite from. The images in this case won't be prefixed.

"sprite": "https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprite"

terrain

Optional terrain.

The terrain configuration.

"terrain": {
  "source": "raster-dem-source",
  "exaggeration": 0.5
}

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.

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

version

Required enum.

Style specification version number. Must be 8.

"version": 8

zoom

Optional number.

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

"zoom": 12.5
MapLibre Style repository Edit page