-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmbstyle.go
81 lines (75 loc) · 2.89 KB
/
mbstyle.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package main
//Version mbstyle version
const Version = 8
const (
//SourceTypeVector 矢量
SourceTypeVector = "vector"
//SourceTypeRaster 影像
SourceTypeRaster = "raster"
//SourceTypeGeoJSON geojson
SourceTypeGeoJSON = "geojson"
//SourceTypeImage 图像
SourceTypeImage = "image"
//SourceTypeVideo 视频
SourceTypeVideo = "video"
//SourceTypeCanvas canvas画布
SourceTypeCanvas = "canvas"
)
//Source 数据源
type Source struct {
Type string `json:"type"`
// An array of one or more tile source URLs, as in the TileJSON spec.
Tiles []string `json:"tiles,omitempty"`
// defaults to 0 if not set
MinZoom int `json:"minzoom,omitempty"`
// defaults to 22 if not set
MaxZoom int `json:"maxzoom,omitempty"`
// url to TileJSON resource
URL string `json:"url,omitempty"`
}
//Light light
type Light struct {
Anchor string `json:"anchor"`
Color string `json:"color"`
Intensity float64 `json:"intensity"`
}
//Transition 变换
type Transition struct{}
//Root 根节点
// https://www.mapbox.com/mapbox-gl-js/style-spec/
type Root struct {
// Style specification version number
Version int `json:"version"`
// A human-readable name for the style.
Name string `json:"name,omitempty"`
// Arbitrary properties useful to track with the stylesheet, but do not influence rendering.
Metadata map[string]interface{} `json:"metadata,omitempty"`
// 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 [2]float64 `json:"center,omitempty"`
// 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 float64 `json:"zoom,omitempty"`
// Default bearing, in degrees clockwise from true north. The style bearing
// will be used only if the map has not been positioned by other means
// (e.g. map options or user interaction).
Bearing *float64 `json:"bearing,omitempty"`
// 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 *float64 `json:"pitch,omitempty"`
// The global light source.
Light *Light `json:"light,omitempty"`
// Data source specifications.
Sources map[string]*Source `json:"sources"`
// URL to sprites. i.e. - mapbox://sprites/mapbox/streets-v8
Sprite string `json:"sprite,omitempty"`
// url to glyphs. i.e. - mapbox://fonts/mapbox/{fontstack}/{range}.pbf
Glyphs string `json:"glyphs,omitempty"`
// A global transition definition to use as a default across properties.
Transition *Transition `json:"transition,omitempty"`
// Layers will be drawn in the order of this array.
Layers []interface{} `json:"layers"`
}