@versatiles/style 5.8.2 → 5.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +570 -333
- package/dist/index.js.map +1 -1
- package/package.json +13 -8
- package/src/color/abstract.ts +1 -1
- package/src/color/hsl.test.ts +10 -16
- package/src/color/hsl.ts +11 -15
- package/src/color/hsv.test.ts +4 -10
- package/src/color/hsv.ts +38 -22
- package/src/color/index.test.ts +2 -4
- package/src/color/index.ts +1 -1
- package/src/color/random.test.ts +1 -1
- package/src/color/random.ts +127 -25
- package/src/color/rgb.test.ts +55 -36
- package/src/color/rgb.ts +35 -48
- package/src/color/utils.test.ts +4 -6
- package/src/color/utils.ts +1 -3
- package/src/guess_style/guess_style.test.ts +49 -43
- package/src/guess_style/guess_style.ts +64 -21
- package/src/guess_style/index.ts +0 -1
- package/src/index.test.ts +34 -7
- package/src/index.ts +29 -19
- package/src/lib/utils.test.ts +2 -2
- package/src/lib/utils.ts +2 -1
- package/src/shortbread/index.ts +0 -1
- package/src/shortbread/layers.test.ts +19 -3
- package/src/shortbread/layers.ts +204 -194
- package/src/shortbread/properties.test.ts +3 -4
- package/src/shortbread/properties.ts +18 -4
- package/src/shortbread/template.test.ts +7 -2
- package/src/shortbread/template.ts +7 -14
- package/src/style_builder/decorator.test.ts +4 -4
- package/src/style_builder/decorator.ts +29 -21
- package/src/style_builder/recolor.test.ts +6 -31
- package/src/style_builder/recolor.ts +20 -20
- package/src/style_builder/style_builder.test.ts +50 -13
- package/src/style_builder/style_builder.ts +29 -31
- package/src/style_builder/types.ts +85 -2
- package/src/styles/LICENSE.md +15 -15
- package/src/styles/colorful.test.ts +91 -0
- package/src/styles/colorful.ts +229 -122
- package/src/styles/eclipse.ts +1 -1
- package/src/styles/empty.ts +1 -1
- package/src/styles/graybeard.ts +2 -2
- package/src/styles/index.ts +0 -3
- package/src/styles/neutrino.ts +14 -16
- package/src/styles/shadow.ts +2 -2
- package/src/types/index.ts +0 -1
- package/src/types/maplibre.ts +17 -3
- package/src/types/tilejson.test.ts +8 -5
- package/src/types/tilejson.ts +13 -13
- package/src/types/vector_layer.test.ts +4 -1
- package/src/types/vector_layer.ts +7 -7
package/src/shortbread/layers.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type {
|
|
2
|
+
DataDrivenPropertyValueSpecification,
|
|
3
|
+
FormattedSpecification,
|
|
4
|
+
LegacyFilterSpecification,
|
|
5
|
+
} from '@maplibre/maplibre-gl-style-spec';
|
|
4
6
|
import type { MaplibreLayerDefinition } from '../types/index.js';
|
|
5
7
|
import { Language } from '../style_builder/types.js';
|
|
6
8
|
|
|
@@ -8,11 +10,10 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
8
10
|
const { language } = option;
|
|
9
11
|
let nameField: DataDrivenPropertyValueSpecification<FormattedSpecification> = ['get', 'name'];
|
|
10
12
|
if (language) {
|
|
11
|
-
nameField = ['
|
|
13
|
+
nameField = ['case', ['to-boolean', ['get', 'name_' + language]], ['get', 'name_' + language], ['get', 'name']];
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
return [
|
|
15
|
-
|
|
16
17
|
// background
|
|
17
18
|
{ id: 'background', type: 'background' },
|
|
18
19
|
|
|
@@ -22,7 +23,8 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
22
23
|
// land
|
|
23
24
|
{
|
|
24
25
|
id: 'land-glacier',
|
|
25
|
-
type: 'fill',
|
|
26
|
+
type: 'fill',
|
|
27
|
+
'source-layer': 'water_polygons',
|
|
26
28
|
filter: ['all', ['==', 'kind', 'glacier']],
|
|
27
29
|
},
|
|
28
30
|
|
|
@@ -30,7 +32,19 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
30
32
|
{ id: 'commercial', kinds: ['commercial', 'retail'] },
|
|
31
33
|
{ id: 'industrial', kinds: ['industrial', 'quarry', 'railway'] },
|
|
32
34
|
{ id: 'residential', kinds: ['garages', 'residential'] },
|
|
33
|
-
{
|
|
35
|
+
{
|
|
36
|
+
id: 'agriculture',
|
|
37
|
+
kinds: [
|
|
38
|
+
'brownfield',
|
|
39
|
+
'farmland',
|
|
40
|
+
'farmyard',
|
|
41
|
+
'greenfield',
|
|
42
|
+
'greenhouse_horticulture',
|
|
43
|
+
'orchard',
|
|
44
|
+
'plant_nursery',
|
|
45
|
+
'vineyard',
|
|
46
|
+
],
|
|
47
|
+
},
|
|
34
48
|
{ id: 'waste', kinds: ['landfill'] },
|
|
35
49
|
{ id: 'park', kinds: ['park', 'village_green', 'recreation_ground'] },
|
|
36
50
|
{ id: 'garden', kinds: ['allotments', 'garden'] },
|
|
@@ -42,91 +56,126 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
42
56
|
{ id: 'vegetation', kinds: ['heath', 'scrub'] },
|
|
43
57
|
{ id: 'sand', kinds: ['beach', 'sand'] },
|
|
44
58
|
{ id: 'wetland', kinds: ['bog', 'marsh', 'string_bog', 'swamp'] },
|
|
45
|
-
].map(
|
|
46
|
-
id:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
['in', 'kind', ...kinds],
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
].map(
|
|
60
|
+
({ id, kinds }: { readonly id: string; readonly kinds: readonly string[] }): MaplibreLayerDefinition => ({
|
|
61
|
+
id: 'land-' + id,
|
|
62
|
+
type: 'fill',
|
|
63
|
+
'source-layer': 'land',
|
|
64
|
+
filter: ['all', ['in', 'kind', ...kinds]],
|
|
65
|
+
})
|
|
66
|
+
),
|
|
53
67
|
|
|
54
68
|
// water-lines
|
|
55
|
-
...['river', 'canal', 'stream', 'ditch'].map(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
['in', 'kind', t],
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
],
|
|
64
|
-
})),
|
|
69
|
+
...['river', 'canal', 'stream', 'ditch'].map(
|
|
70
|
+
(t: string): MaplibreLayerDefinition => ({
|
|
71
|
+
id: 'water-' + t,
|
|
72
|
+
type: 'line',
|
|
73
|
+
'source-layer': 'water_lines',
|
|
74
|
+
filter: ['all', ['in', 'kind', t], ['!=', 'tunnel', true], ['!=', 'bridge', true]],
|
|
75
|
+
})
|
|
76
|
+
),
|
|
65
77
|
|
|
66
78
|
// water polygons
|
|
67
79
|
{
|
|
68
80
|
id: 'water-area',
|
|
69
|
-
type: 'fill',
|
|
81
|
+
type: 'fill',
|
|
82
|
+
'source-layer': 'water_polygons',
|
|
70
83
|
filter: ['==', 'kind', 'water'],
|
|
71
84
|
},
|
|
72
85
|
{
|
|
73
86
|
id: 'water-area-river',
|
|
74
|
-
type: 'fill',
|
|
87
|
+
type: 'fill',
|
|
88
|
+
'source-layer': 'water_polygons',
|
|
75
89
|
filter: ['==', 'kind', 'river'],
|
|
76
90
|
},
|
|
77
91
|
{
|
|
78
92
|
id: 'water-area-small',
|
|
79
|
-
type: 'fill',
|
|
93
|
+
type: 'fill',
|
|
94
|
+
'source-layer': 'water_polygons',
|
|
80
95
|
filter: ['in', 'kind', 'reservoir', 'basin', 'dock'],
|
|
81
96
|
},
|
|
82
97
|
|
|
83
|
-
|
|
84
98
|
// dam
|
|
85
99
|
{ id: 'water-dam-area', type: 'fill', 'source-layer': 'dam_polygons', filter: ['==', 'kind', 'dam'] },
|
|
86
100
|
{ id: 'water-dam', type: 'line', 'source-layer': 'dam_lines', filter: ['==', 'kind', 'dam'] },
|
|
87
101
|
|
|
88
102
|
// pier
|
|
89
|
-
{
|
|
90
|
-
|
|
103
|
+
{
|
|
104
|
+
id: 'water-pier-area',
|
|
105
|
+
type: 'fill',
|
|
106
|
+
'source-layer': 'pier_polygons',
|
|
107
|
+
filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'water-pier',
|
|
111
|
+
type: 'line',
|
|
112
|
+
'source-layer': 'pier_lines',
|
|
113
|
+
filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'],
|
|
114
|
+
},
|
|
91
115
|
|
|
92
116
|
// site
|
|
93
|
-
...[
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
'
|
|
97
|
-
|
|
98
|
-
|
|
117
|
+
...[
|
|
118
|
+
'danger_area',
|
|
119
|
+
'sports_center',
|
|
120
|
+
'university',
|
|
121
|
+
'college',
|
|
122
|
+
'school',
|
|
123
|
+
'hospital',
|
|
124
|
+
'prison',
|
|
125
|
+
'parking',
|
|
126
|
+
'bicycle_parking',
|
|
127
|
+
'construction',
|
|
128
|
+
].map(
|
|
129
|
+
(t): MaplibreLayerDefinition => ({
|
|
130
|
+
id: 'site-' + t.replace(/_/g, ''),
|
|
131
|
+
type: 'fill',
|
|
132
|
+
'source-layer': 'sites',
|
|
133
|
+
filter: ['in', 'kind', t],
|
|
134
|
+
})
|
|
135
|
+
),
|
|
99
136
|
|
|
100
137
|
// airport
|
|
101
138
|
{
|
|
102
139
|
id: 'airport-area',
|
|
103
|
-
type: 'fill',
|
|
140
|
+
type: 'fill',
|
|
141
|
+
'source-layer': 'street_polygons',
|
|
142
|
+
filter: ['in', 'kind', 'runway', 'taxiway'],
|
|
104
143
|
},
|
|
105
144
|
{
|
|
106
145
|
id: 'airport-taxiway:outline',
|
|
107
|
-
type: 'line',
|
|
146
|
+
type: 'line',
|
|
147
|
+
'source-layer': 'streets',
|
|
148
|
+
filter: ['==', 'kind', 'taxiway'],
|
|
108
149
|
},
|
|
109
150
|
{
|
|
110
151
|
id: 'airport-runway:outline',
|
|
111
|
-
type: 'line',
|
|
152
|
+
type: 'line',
|
|
153
|
+
'source-layer': 'streets',
|
|
154
|
+
filter: ['==', 'kind', 'runway'],
|
|
112
155
|
},
|
|
113
156
|
{
|
|
114
157
|
id: 'airport-taxiway',
|
|
115
|
-
type: 'line',
|
|
158
|
+
type: 'line',
|
|
159
|
+
'source-layer': 'streets',
|
|
160
|
+
filter: ['==', 'kind', 'taxiway'],
|
|
116
161
|
},
|
|
117
162
|
{
|
|
118
163
|
id: 'airport-runway',
|
|
119
|
-
type: 'line',
|
|
164
|
+
type: 'line',
|
|
165
|
+
'source-layer': 'streets',
|
|
166
|
+
filter: ['==', 'kind', 'runway'],
|
|
120
167
|
},
|
|
121
168
|
|
|
122
169
|
// building
|
|
123
170
|
{
|
|
124
171
|
id: 'building:outline',
|
|
125
|
-
type: 'fill',
|
|
172
|
+
type: 'fill',
|
|
173
|
+
'source-layer': 'buildings',
|
|
126
174
|
},
|
|
127
175
|
{
|
|
128
176
|
id: 'building',
|
|
129
|
-
type: 'fill',
|
|
177
|
+
type: 'fill',
|
|
178
|
+
'source-layer': 'buildings',
|
|
130
179
|
},
|
|
131
180
|
|
|
132
181
|
// tunnel-, street-, bridges-bridge
|
|
@@ -142,7 +191,10 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
142
191
|
suffixes = [':outline', ''];
|
|
143
192
|
break;
|
|
144
193
|
case 'street':
|
|
145
|
-
filter = [
|
|
194
|
+
filter = [
|
|
195
|
+
['!=', 'bridge', true],
|
|
196
|
+
['!=', 'tunnel', true],
|
|
197
|
+
];
|
|
146
198
|
prefix = '';
|
|
147
199
|
suffixes = [':outline', ''];
|
|
148
200
|
break;
|
|
@@ -153,7 +205,6 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
153
205
|
break;
|
|
154
206
|
}
|
|
155
207
|
|
|
156
|
-
|
|
157
208
|
// in osm data streets on bridges are often not tagged as such
|
|
158
209
|
// to be able to have multiple levels of bridges cross over each
|
|
159
210
|
// other in the right order without using a secondary property.
|
|
@@ -163,111 +214,85 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
163
214
|
// it's simpler than removing all these tagging hacks from osm.
|
|
164
215
|
|
|
165
216
|
// bridges, above tunnel, below street
|
|
166
|
-
if (c === 'street')
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
'source-layer': 'bridges',
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
suffixes.forEach(suffix => {
|
|
173
|
-
|
|
174
|
-
// pedestrian zone — no outline
|
|
175
|
-
if (suffix === ':outline') results.push({
|
|
176
|
-
id: prefix + 'street-pedestrian-zone',
|
|
217
|
+
if (c === 'street')
|
|
218
|
+
results.push({
|
|
219
|
+
id: 'bridge',
|
|
177
220
|
type: 'fill',
|
|
178
|
-
'source-layer': '
|
|
179
|
-
filter: ['all',
|
|
180
|
-
...filter,
|
|
181
|
-
['==', 'kind', 'pedestrian'],
|
|
182
|
-
],
|
|
221
|
+
'source-layer': 'bridges',
|
|
183
222
|
});
|
|
184
223
|
|
|
224
|
+
suffixes.forEach((suffix) => {
|
|
225
|
+
// pedestrian zone — no outline
|
|
226
|
+
if (suffix === ':outline')
|
|
227
|
+
results.push({
|
|
228
|
+
id: prefix + 'street-pedestrian-zone',
|
|
229
|
+
type: 'fill',
|
|
230
|
+
'source-layer': 'street_polygons',
|
|
231
|
+
filter: ['all', ...filter, ['==', 'kind', 'pedestrian']],
|
|
232
|
+
});
|
|
233
|
+
|
|
185
234
|
// non-car streets
|
|
186
|
-
['footway', 'steps', 'path', 'cycleway'].forEach(t => {
|
|
235
|
+
['footway', 'steps', 'path', 'cycleway'].forEach((t) => {
|
|
187
236
|
results.push({
|
|
188
237
|
id: prefix + 'way-' + t.replace(/_/g, '') + suffix,
|
|
189
238
|
type: 'line',
|
|
190
239
|
'source-layer': 'streets',
|
|
191
|
-
filter: ['all',
|
|
192
|
-
...filter,
|
|
193
|
-
['in', 'kind', t],
|
|
194
|
-
],
|
|
240
|
+
filter: ['all', ...filter, ['in', 'kind', t]],
|
|
195
241
|
});
|
|
196
242
|
});
|
|
197
243
|
|
|
198
244
|
// no links
|
|
199
|
-
['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach(t => {
|
|
245
|
+
['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach((t) => {
|
|
200
246
|
results.push({
|
|
201
247
|
id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
|
|
202
248
|
type: 'line',
|
|
203
249
|
'source-layer': 'streets',
|
|
204
|
-
filter: ['all',
|
|
205
|
-
['==', 'kind', t],
|
|
206
|
-
...filter,
|
|
207
|
-
],
|
|
250
|
+
filter: ['all', ['==', 'kind', t], ...filter],
|
|
208
251
|
});
|
|
209
252
|
});
|
|
210
253
|
|
|
211
254
|
// no links, bicycle=designated
|
|
212
|
-
if (suffix === '')
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
['==', 'kind', t],
|
|
219
|
-
|
|
220
|
-
...filter,
|
|
221
|
-
],
|
|
255
|
+
if (suffix === '')
|
|
256
|
+
['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach((t) => {
|
|
257
|
+
results.push({
|
|
258
|
+
id: prefix + 'street-' + t.replace(/_/g, '') + '-bicycle',
|
|
259
|
+
type: 'line',
|
|
260
|
+
'source-layer': 'streets',
|
|
261
|
+
filter: ['all', ['==', 'kind', t], ['==', 'bicycle', 'designated'], ...filter],
|
|
262
|
+
});
|
|
222
263
|
});
|
|
223
|
-
});
|
|
224
264
|
|
|
225
265
|
// links
|
|
226
|
-
['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach(t => {
|
|
266
|
+
['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach((t) => {
|
|
227
267
|
results.push({
|
|
228
268
|
id: prefix + 'street-' + t.replace(/_/g, '') + '-link' + suffix,
|
|
229
269
|
type: 'line',
|
|
230
270
|
'source-layer': 'streets',
|
|
231
|
-
filter: ['all',
|
|
232
|
-
...filter,
|
|
233
|
-
['in', 'kind', t],
|
|
234
|
-
['==', 'link', true],
|
|
235
|
-
],
|
|
271
|
+
filter: ['all', ...filter, ['in', 'kind', t], ['==', 'link', true]],
|
|
236
272
|
});
|
|
237
273
|
});
|
|
238
274
|
|
|
239
275
|
// main
|
|
240
|
-
['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach(t => {
|
|
276
|
+
['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach((t) => {
|
|
241
277
|
results.push({
|
|
242
278
|
id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
|
|
243
279
|
type: 'line',
|
|
244
280
|
'source-layer': 'streets',
|
|
245
|
-
filter: ['all',
|
|
246
|
-
...filter,
|
|
247
|
-
['in', 'kind', t],
|
|
248
|
-
['!=', 'link', true],
|
|
249
|
-
],
|
|
281
|
+
filter: ['all', ...filter, ['in', 'kind', t], ['!=', 'link', true]],
|
|
250
282
|
});
|
|
251
283
|
});
|
|
252
|
-
|
|
253
284
|
});
|
|
254
285
|
|
|
255
286
|
// separate outline for trains
|
|
256
|
-
[':outline', ''].forEach(suffix => {
|
|
257
|
-
|
|
287
|
+
[':outline', ''].forEach((suffix) => {
|
|
258
288
|
// with service distinction
|
|
259
289
|
['rail', 'light_rail', 'subway', 'narrow_gauge', 'tram'].reverse().forEach((t) => {
|
|
260
|
-
|
|
261
290
|
// main rail
|
|
262
291
|
results.push({
|
|
263
292
|
id: prefix + 'transport-' + t.replace(/_/g, '') + suffix,
|
|
264
293
|
type: 'line',
|
|
265
294
|
'source-layer': 'streets',
|
|
266
|
-
filter: ['all',
|
|
267
|
-
['in', 'kind', t],
|
|
268
|
-
['!has', 'service'],
|
|
269
|
-
...filter,
|
|
270
|
-
],
|
|
295
|
+
filter: ['all', ['in', 'kind', t], ['!has', 'service'], ...filter],
|
|
271
296
|
});
|
|
272
297
|
|
|
273
298
|
// service rail (crossover, siding, spur, yard)
|
|
@@ -275,11 +300,7 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
275
300
|
id: prefix + 'transport-' + t.replace(/_/g, '') + '-service' + suffix,
|
|
276
301
|
type: 'line',
|
|
277
302
|
'source-layer': 'streets',
|
|
278
|
-
filter: ['all',
|
|
279
|
-
['in', 'kind', t],
|
|
280
|
-
['has', 'service'],
|
|
281
|
-
...filter,
|
|
282
|
-
],
|
|
303
|
+
filter: ['all', ['in', 'kind', t], ['has', 'service'], ...filter],
|
|
283
304
|
});
|
|
284
305
|
});
|
|
285
306
|
|
|
@@ -289,26 +310,22 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
289
310
|
id: prefix + 'transport-' + t.replace(/_/g, '') + suffix,
|
|
290
311
|
type: 'line',
|
|
291
312
|
'source-layer': 'streets',
|
|
292
|
-
filter: ['all',
|
|
293
|
-
['in', 'kind', t],
|
|
294
|
-
...filter,
|
|
295
|
-
],
|
|
313
|
+
filter: ['all', ['in', 'kind', t], ...filter],
|
|
296
314
|
});
|
|
297
315
|
});
|
|
298
316
|
|
|
299
317
|
if (c === 'street') {
|
|
300
318
|
// aerialway, no bridges, above street evel
|
|
301
|
-
['cable_car', 'gondola', 'goods', 'chair_lift', 'drag_lift', 't-bar', 'j-bar', 'platter', 'rope-tow']
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
['in', 'kind', t],
|
|
309
|
-
|
|
319
|
+
['cable_car', 'gondola', 'goods', 'chair_lift', 'drag_lift', 't-bar', 'j-bar', 'platter', 'rope-tow']
|
|
320
|
+
.reverse()
|
|
321
|
+
.forEach((t) => {
|
|
322
|
+
results.push({
|
|
323
|
+
id: 'aerialway-' + t.replace(/[_-]+/g, '') + suffix,
|
|
324
|
+
type: 'line',
|
|
325
|
+
'source-layer': 'aerialways',
|
|
326
|
+
filter: ['all', ...filter, ['in', 'kind', t]],
|
|
327
|
+
});
|
|
310
328
|
});
|
|
311
|
-
});
|
|
312
329
|
|
|
313
330
|
// ferry — only on street level
|
|
314
331
|
results.push({
|
|
@@ -323,13 +340,15 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
323
340
|
}),
|
|
324
341
|
|
|
325
342
|
// poi, one layer per type
|
|
326
|
-
...['amenity', 'leisure', 'tourism', 'shop', 'man_made', 'historic', 'emergency', 'highway', 'office'].map(
|
|
327
|
-
|
|
343
|
+
...['amenity', 'leisure', 'tourism', 'shop', 'man_made', 'historic', 'emergency', 'highway', 'office'].map(
|
|
344
|
+
(key): MaplibreLayerDefinition => ({
|
|
345
|
+
id: 'poi-' + key,
|
|
328
346
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
347
|
+
type: 'symbol',
|
|
348
|
+
'source-layer': 'pois',
|
|
349
|
+
filter: ['to-boolean', ['get', key]],
|
|
350
|
+
})
|
|
351
|
+
),
|
|
333
352
|
|
|
334
353
|
// boundary
|
|
335
354
|
...[':outline', ''].flatMap((suffix): MaplibreLayerDefinition[] => [
|
|
@@ -337,7 +356,8 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
337
356
|
id: 'boundary-country' + suffix,
|
|
338
357
|
type: 'line',
|
|
339
358
|
'source-layer': 'boundaries',
|
|
340
|
-
filter: [
|
|
359
|
+
filter: [
|
|
360
|
+
'all',
|
|
341
361
|
['==', 'admin_level', 2],
|
|
342
362
|
['!=', 'maritime', true],
|
|
343
363
|
['!=', 'disputed', true],
|
|
@@ -348,7 +368,8 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
348
368
|
id: 'boundary-country-disputed' + suffix,
|
|
349
369
|
type: 'line',
|
|
350
370
|
'source-layer': 'boundaries',
|
|
351
|
-
filter: [
|
|
371
|
+
filter: [
|
|
372
|
+
'all',
|
|
352
373
|
['==', 'admin_level', 2],
|
|
353
374
|
['==', 'disputed', true],
|
|
354
375
|
['!=', 'maritime', true],
|
|
@@ -359,7 +380,8 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
359
380
|
id: 'boundary-country-maritime' + suffix,
|
|
360
381
|
type: 'line',
|
|
361
382
|
'source-layer': 'boundaries',
|
|
362
|
-
filter: [
|
|
383
|
+
filter: [
|
|
384
|
+
'all',
|
|
363
385
|
['==', 'admin_level', 2],
|
|
364
386
|
['==', 'maritime', true],
|
|
365
387
|
['!=', 'disputed', true],
|
|
@@ -370,7 +392,8 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
370
392
|
id: 'boundary-state' + suffix,
|
|
371
393
|
type: 'line',
|
|
372
394
|
'source-layer': 'boundaries',
|
|
373
|
-
filter: [
|
|
395
|
+
filter: [
|
|
396
|
+
'all',
|
|
374
397
|
['==', 'admin_level', 4],
|
|
375
398
|
['!=', 'maritime', true],
|
|
376
399
|
['!=', 'disputed', true],
|
|
@@ -407,22 +430,33 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
407
430
|
},
|
|
408
431
|
|
|
409
432
|
// label-street
|
|
410
|
-
...['pedestrian', 'living_street', 'residential', 'unclassified', 'tertiary', 'secondary', 'primary', 'trunk'].map(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
433
|
+
...['pedestrian', 'living_street', 'residential', 'unclassified', 'tertiary', 'secondary', 'primary', 'trunk'].map(
|
|
434
|
+
(t: string): MaplibreLayerDefinition => ({
|
|
435
|
+
id: 'label-street-' + t.replace(/_/g, ''),
|
|
436
|
+
type: 'symbol',
|
|
437
|
+
'source-layer': 'street_labels',
|
|
438
|
+
filter: ['==', 'kind', t],
|
|
439
|
+
layout: { 'text-field': nameField },
|
|
440
|
+
})
|
|
441
|
+
),
|
|
417
442
|
|
|
418
443
|
// label-place of small places
|
|
419
|
-
...[
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
'
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
444
|
+
...[
|
|
445
|
+
/*'locality', 'island', 'farm', 'dwelling',*/ 'neighbourhood',
|
|
446
|
+
'quarter',
|
|
447
|
+
'suburb',
|
|
448
|
+
'hamlet',
|
|
449
|
+
'village',
|
|
450
|
+
'town',
|
|
451
|
+
].map(
|
|
452
|
+
(id: string): MaplibreLayerDefinition => ({
|
|
453
|
+
id: 'label-place-' + id.replace(/_/g, ''),
|
|
454
|
+
type: 'symbol',
|
|
455
|
+
'source-layer': 'place_labels',
|
|
456
|
+
filter: ['==', 'kind', id],
|
|
457
|
+
layout: { 'text-field': nameField },
|
|
458
|
+
})
|
|
459
|
+
),
|
|
426
460
|
|
|
427
461
|
// label-boundary
|
|
428
462
|
{
|
|
@@ -434,43 +468,35 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
434
468
|
},
|
|
435
469
|
|
|
436
470
|
// label-place-* of large places
|
|
437
|
-
...['city', 'state_capital', 'capital'].map(
|
|
438
|
-
id:
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
471
|
+
...['city', 'state_capital', 'capital'].map(
|
|
472
|
+
(id: string): MaplibreLayerDefinition => ({
|
|
473
|
+
id: 'label-place-' + id.replace(/_/g, ''),
|
|
474
|
+
type: 'symbol',
|
|
475
|
+
'source-layer': 'place_labels',
|
|
476
|
+
filter: ['==', 'kind', id],
|
|
477
|
+
layout: { 'text-field': nameField },
|
|
478
|
+
})
|
|
479
|
+
),
|
|
444
480
|
|
|
445
481
|
{
|
|
446
482
|
id: 'label-boundary-country-small',
|
|
447
483
|
type: 'symbol',
|
|
448
484
|
'source-layer': 'boundary_labels',
|
|
449
|
-
filter: ['all',
|
|
450
|
-
['in', 'admin_level', 2, '2'],
|
|
451
|
-
['<=', 'way_area', 10000000],
|
|
452
|
-
],
|
|
485
|
+
filter: ['all', ['in', 'admin_level', 2, '2'], ['<=', 'way_area', 10000000]],
|
|
453
486
|
layout: { 'text-field': nameField },
|
|
454
487
|
},
|
|
455
488
|
{
|
|
456
489
|
id: 'label-boundary-country-medium',
|
|
457
490
|
type: 'symbol',
|
|
458
491
|
'source-layer': 'boundary_labels',
|
|
459
|
-
filter: ['all',
|
|
460
|
-
['in', 'admin_level', 2, '2'],
|
|
461
|
-
['<', 'way_area', 90000000],
|
|
462
|
-
['>', 'way_area', 10000000],
|
|
463
|
-
],
|
|
492
|
+
filter: ['all', ['in', 'admin_level', 2, '2'], ['<', 'way_area', 90000000], ['>', 'way_area', 10000000]],
|
|
464
493
|
layout: { 'text-field': nameField },
|
|
465
494
|
},
|
|
466
495
|
{
|
|
467
496
|
id: 'label-boundary-country-large',
|
|
468
497
|
type: 'symbol',
|
|
469
498
|
'source-layer': 'boundary_labels',
|
|
470
|
-
filter: ['all',
|
|
471
|
-
['in', 'admin_level', 2, '2'],
|
|
472
|
-
['>=', 'way_area', 90000000],
|
|
473
|
-
],
|
|
499
|
+
filter: ['all', ['in', 'admin_level', 2, '2'], ['>=', 'way_area', 90000000]],
|
|
474
500
|
layout: { 'text-field': nameField },
|
|
475
501
|
},
|
|
476
502
|
|
|
@@ -479,7 +505,8 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
479
505
|
id: 'marking-oneway', // streets → oneway
|
|
480
506
|
type: 'symbol',
|
|
481
507
|
'source-layer': 'streets',
|
|
482
|
-
filter: [
|
|
508
|
+
filter: [
|
|
509
|
+
'all',
|
|
483
510
|
['==', 'oneway', true],
|
|
484
511
|
['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
|
|
485
512
|
],
|
|
@@ -496,7 +523,8 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
496
523
|
id: 'marking-oneway-reverse', // oneway_reverse
|
|
497
524
|
type: 'symbol',
|
|
498
525
|
'source-layer': 'streets',
|
|
499
|
-
filter: [
|
|
526
|
+
filter: [
|
|
527
|
+
'all',
|
|
500
528
|
['==', 'oneway_reverse', true],
|
|
501
529
|
['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
|
|
502
530
|
],
|
|
@@ -513,10 +541,7 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
513
541
|
id: 'marking-bicycle', // bicycle=designated or kind=cycleway
|
|
514
542
|
type: 'symbol',
|
|
515
543
|
'source-layer': 'streets',
|
|
516
|
-
filter: ['all',
|
|
517
|
-
['==', 'bicycle', 'designated'],
|
|
518
|
-
['==', 'kind', 'cycleway'],
|
|
519
|
-
],
|
|
544
|
+
filter: ['all', ['==', 'bicycle', 'designated'], ['==', 'kind', 'cycleway']],
|
|
520
545
|
layout: {
|
|
521
546
|
'symbol-placement': 'line',
|
|
522
547
|
'symbol-spacing': 50,
|
|
@@ -542,51 +567,36 @@ export function getShortbreadLayers(option: { readonly language: Language }): Ma
|
|
|
542
567
|
id: 'symbol-transit-subway',
|
|
543
568
|
type: 'symbol',
|
|
544
569
|
'source-layer': 'public_transport',
|
|
545
|
-
filter: ['all',
|
|
546
|
-
['in', 'kind', 'station', 'halt'],
|
|
547
|
-
['==', 'station', 'subway'],
|
|
548
|
-
],
|
|
570
|
+
filter: ['all', ['in', 'kind', 'station', 'halt'], ['==', 'station', 'subway']],
|
|
549
571
|
layout: { 'text-field': nameField },
|
|
550
572
|
},
|
|
551
573
|
{
|
|
552
574
|
id: 'symbol-transit-lightrail',
|
|
553
575
|
type: 'symbol',
|
|
554
576
|
'source-layer': 'public_transport',
|
|
555
|
-
filter: ['all',
|
|
556
|
-
['in', 'kind', 'station', 'halt'],
|
|
557
|
-
['==', 'station', 'light_rail'],
|
|
558
|
-
],
|
|
577
|
+
filter: ['all', ['in', 'kind', 'station', 'halt'], ['==', 'station', 'light_rail']],
|
|
559
578
|
layout: { 'text-field': nameField },
|
|
560
579
|
},
|
|
561
580
|
{
|
|
562
581
|
id: 'symbol-transit-station',
|
|
563
582
|
type: 'symbol',
|
|
564
583
|
'source-layer': 'public_transport',
|
|
565
|
-
filter: ['all',
|
|
566
|
-
['in', 'kind', 'station', 'halt'],
|
|
567
|
-
['!in', 'station', 'light_rail', 'subway'],
|
|
568
|
-
],
|
|
584
|
+
filter: ['all', ['in', 'kind', 'station', 'halt'], ['!in', 'station', 'light_rail', 'subway']],
|
|
569
585
|
layout: { 'text-field': nameField },
|
|
570
586
|
},
|
|
571
587
|
{
|
|
572
588
|
id: 'symbol-transit-airfield',
|
|
573
589
|
type: 'symbol',
|
|
574
590
|
'source-layer': 'public_transport',
|
|
575
|
-
filter: ['all',
|
|
576
|
-
['==', 'kind', 'aerodrome'],
|
|
577
|
-
['!has', 'iata'],
|
|
578
|
-
],
|
|
591
|
+
filter: ['all', ['==', 'kind', 'aerodrome'], ['!has', 'iata']],
|
|
579
592
|
layout: { 'text-field': nameField },
|
|
580
593
|
},
|
|
581
594
|
{
|
|
582
595
|
id: 'symbol-transit-airport',
|
|
583
596
|
type: 'symbol',
|
|
584
597
|
'source-layer': 'public_transport',
|
|
585
|
-
filter: ['all',
|
|
586
|
-
['==', 'kind', 'aerodrome'],
|
|
587
|
-
['has', 'iata'],
|
|
588
|
-
],
|
|
598
|
+
filter: ['all', ['==', 'kind', 'aerodrome'], ['has', 'iata']],
|
|
589
599
|
layout: { 'text-field': nameField },
|
|
590
600
|
},
|
|
591
601
|
];
|
|
592
|
-
}
|
|
602
|
+
}
|