Skip to main content

style

In Mapbox, a style is a JSON document that defines the visual appearance of a map.

A style must adhere to the Mapbox Style Specification. A style must include information about data sources and style layers. Additional information like metadata and sprites or glyphs properties is optional.

Here is an example style JSON showing one style layer:

{
"version": 8,
"name": "Meteorites",
"metadata": {
"mapbox:origin": "basic-template-v1",
"mapbox:autocomposite": true,
"mapbox:type": "template",
"mapbox:sdk-support": {
"js": "0.45.0",
"android": "6.0.0",
"ios": "4.0.0"
}
},
"center": [
74.24426803763072,
-2.2507114487818853
],
"zoom": 0.6851443156248076,
"bearing": 0,
"pitch": 0,
"sources": {
"composite": {
"url": "mapbox://mapbox.mapbox-streets-v8,examples.0fr72zt8",
"type": "vector"
}
},
"sprite": "mapbox://sprites/examples/cjikt35x83t1z2rnxpdmjs7y7",
"glyphs": "mapbox://fonts/{username}/{fontstack}/{range}.pbf",
"layers": [
{
"id": "background",
"type": "background",
"layout": {},
"paint": {
"background-color": [ ]
}
},
{ ... }
],
"created": "2015-10-30T22:18:31.111Z",
"id": "cjikt35x83t1z2rnxpdmjs7y7",
"modified": "2015-10-30T22:22:06.077Z",
"owner": "examples",
"visibility": "public",
"draft": false
}

You can create a style with the Mapbox Studio style editor. You can also write a style document independently and upload it to your account using the Mapbox Styles API. You can retrieve a style directly using the Mapbox Styles API.

You can use a Mapbox-hosted style by referencing its style ID or style URL in your web or mobile app.

Related resources:

Was this page helpful?