summaryrefslogtreecommitdiff
path: root/bin/style.js
blob: 7ca40b6123ece5d57b86c754b4329e3a03a3d274 (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
"use strict";

module.exports = {
  "version": 3,
  "constants": {
    "@land": "#eee",
    "@water": "#999",
    "@park": "#bda",
    "@road": "#fefefe",
    "@border": "#6d90ab",
    "@building": "#ddd",
    "@building_outline": "#ccc",
    "@text": "#000000",
    "@road_blur": 1,
    "@stroke_width": 0.25
  },
  "sources": {
    "mapbox.mapbox-streets-v5": {
      "type": "vector",
      "url": "mapbox://mapbox.mapbox-streets-v5",
      "glyphs": "http://mapbox.s3.amazonaws.com/gl-glyphs-256/{fontstack}/{range}.pbf",
      "maxZoom": 14
    }
  },
  "layers": [{
    "id": "background",
    "style": {
      "fill-color": "@land",
      "transition-fill-color": {
        "duration": 500,
        "delay": 0
      }
    }
  }, {
    "id": "park",
    "source": "mapbox.mapbox-streets-v5",
    "source-layer": "landuse",
    "filter": { "class": "park" },
    "render": {
      "type": "fill"
    },
    "style": {
      "fill-color": "@park"
    }
  }, {
    "id": "water",
    "source": "mapbox.mapbox-streets-v5",
    "source-layer": "water",
    "render": {
      "type": "fill"
    },
    "style": {
      "fill-color": "blue"
    }
  }, {
    "id": "roads",
    "layers": [{
      "id": "road",
      "source": "mapbox.mapbox-streets-v5",
      "source-layer": "road",
      "render": {
        "type": "line",
        "line-cap": "round",
        "line-join": "bevel"
      },
      "style": {
        "line-color": "@road",
        "line-blur": "@road_blur",
        "line-width": {
          "fn": "exponential",
          "z": 10,
          "val": -1,
          "slope": 0.2,
          "min": 1
        }
      }
    }]
  }, {
    "id": "building",
    "source": "mapbox.mapbox-streets-v5",
    "source-layer": "building",
    "render": {
      "type": "fill"
    },
    "style": {
      "fill-color": "@building",
      "transition-fill-opacity": {
        "duration": 500,
        "delay": 500
      },
      "fill-opacity": {
        "fn": "linear",
        "z": 14,
        "val": 0,
        "slope": 1,
        "min": 0,
        "max": 1
      }
    }
  }, {
    "id": "borders",
    "source": "mapbox.mapbox-streets-v5",
    "source-layer": "admin",
    "render": {
      "type": "line"
    },
    "style": {
      "line-color": "rgba(0, 0, 0, 0.3)",
      "line-width": 1
    }
  }, {
    "id": "poi",
    "source": "mapbox.mapbox-streets-v5",
    "source-layer": "poi_label",
    "render": {
      "type": "icon",
      "icon-size": 12
    },
    "style": {
      "icon-rotate-anchor": "viewport"
    }
  }, {
    "id": "country_label",
    "source": "mapbox.mapbox-streets-v5",
    "source-layer": "country_label",
    "filter": { "$type": "point" },
    "render": {
      "type": "text",
      "text-field": "{{name}}",
      "text-font": "Open Sans Regular, Arial Unicode MS Regular",
      "text-max-size": 16,
      "text-path": "horizontal",
      "text-padding": 10
    },
    "style": {
      "text-halo-color": "rgba(255, 255, 255, 0.7)",
      "text-halo-width": "@stroke_width",
      "text-color": "@text"
    }
  }, {
    "id": "road_label",
    "source": "mapbox.mapbox-streets-v5",
    "source-layer": "road_label",
    "filter": { "$type": "line" },
    "render": {
      "type": "text",
      "text-field": "{{name}}",
      "text-font": "Open Sans Regular, Arial Unicode MS Regular",
      "text-max-size": 12,
      "text-path": "curve",
      "text-min-distance": 250,
      "text-max-angle": 1.04
    },
    "style": {
      "text-color": "@text",
      "text-halo-color": "rgba(255, 255, 255, 0.7)",
      "text-halo-width": "@stroke_width",
      "text-size": {
        "fn": "exponential",
        "z": 14,
        "val": 8,
        "slope": 1,
        "min": 8,
        "max": 12
      }
    }
  }]
};