Skip to main content

Overview

Mapmost Style includes version, name, sprite, sources, layers and other attributes. The specific form is as follows:

{
"version": 8,
"name": "Mapmost Style",
"sprite": "http://***/vt_map/sprite/sprite",
"glyphs": "http://***/vt_map/font/{fontstack}/{range}.pbf",
"sources": {...},
"layers": [...]
}

Required attributes​

layers​

Required attribute. array

The layers will be drawn in the order of the array.

"layers": [
{
"id": "water",
"source": "mapmost-style",
"source-layer": "water",
"type": "fill",
"paint": {
"fill-color": "#00ffff"
}
}
]

sources​

Required attribute. object

The data source specifications are as follows:

"sources": {
"mapmost-streets": {
"type": "vector",
"url": "http://******.json"
}
}

version​

Required attribute. enum

Style version specification number, must be 8

"version": 8

Optional attributes​

bearing​

Optional attribute. number. Unit degree, default value 0.

Default bearing, expressed in degrees. Bearing refers to the compass direction of "north"; for example, if set to 90°, the top of the map is east. This value is only used when there is no other way to locate (such as map options or user interaction).

"bearing": 90

center​

Optional attribute. array

Default map center, including longitude and latitude. The default center in the style is only used when there is no other way to position it (such as map options or user interaction).

"center": [
120.31249,
31.7736
]

glyphs​

Optional attribute. string

A URL template used to load PBF formatted SDF sets. URL must contain {fontstack} and {range} tags. This attribute is required if any layer uses the text-field attribute.

"glyphs": "http://***/vt_map/font/{fontstack}/{range}.pbf"

light​

Optional attribute. light ':type=code').

global light source

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

name​

Optional attribute. string

The name of the style file.

"name": "SIPSG"

pitch​

Optional attribute. number. The unit is degrees, and the default value is 0.

Default viewing angle, in degrees. When the value is 0, the line of sight is perpendicular to the map, looking down on the map. When the value increases, such as 60, it is facing the horizon ahead. The perspective in the style file will only be used if there is no other way to position it (such as a map option or user interaction).

"pitch": 50

sprite​

Optional attribute. string

Get the base URL of the sprite image and metadata. The extensions .png, .json and scaling factor @2x.png will be added automatically. This attribute is required if any layer uses background-pattern, fill-pattern, line-pattern, fill-extrusion-pattern or icon-image.

"sprite": "http://***/vt_map/sprite/sprite"

transition​

Optional attribute. transition.

The global transition attribute is used as the default value of multiple attributes and is used to set the transition effect of two value transformations. The process of symbol disappearance due to avoidance does not belong to transition attribute control.

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

zoom​

Optional attribute. number

Default map level. The default map level in the style is only used when there is no other way to position it (such as map options or user interaction).

"zoom": 12.5