@versatiles/style 3.4.0
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/LICENSE.md +24 -0
- package/README.MD +94 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +38 -0
- package/dist/lib/decorator.d.ts +3 -0
- package/dist/lib/decorator.js +123 -0
- package/dist/lib/decorator.test.d.ts +1 -0
- package/dist/lib/decorator.test.js +56 -0
- package/dist/lib/recolor.d.ts +13 -0
- package/dist/lib/recolor.js +92 -0
- package/dist/lib/recolor.test.d.ts +1 -0
- package/dist/lib/recolor.test.js +179 -0
- package/dist/lib/shortbread/layers.d.ts +7 -0
- package/dist/lib/shortbread/layers.js +508 -0
- package/dist/lib/shortbread/layers.test.d.ts +1 -0
- package/dist/lib/shortbread/layers.test.js +27 -0
- package/dist/lib/shortbread/properties.d.ts +7 -0
- package/dist/lib/shortbread/properties.js +124 -0
- package/dist/lib/shortbread/properties.test.d.ts +1 -0
- package/dist/lib/shortbread/properties.test.js +36 -0
- package/dist/lib/shortbread/template.d.ts +2 -0
- package/dist/lib/shortbread/template.js +339 -0
- package/dist/lib/shortbread/template.test.d.ts +1 -0
- package/dist/lib/shortbread/template.test.js +57 -0
- package/dist/lib/style_builder.d.ts +32 -0
- package/dist/lib/style_builder.js +84 -0
- package/dist/lib/style_builder.test.d.ts +1 -0
- package/dist/lib/style_builder.test.js +77 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.js +106 -0
- package/dist/lib/utils.test.d.ts +1 -0
- package/dist/lib/utils.test.js +97 -0
- package/dist/styles/colorful.d.ts +53 -0
- package/dist/styles/colorful.js +871 -0
- package/dist/styles/graybeard.d.ts +5 -0
- package/dist/styles/graybeard.js +9 -0
- package/dist/styles/neutrino.d.ts +24 -0
- package/dist/styles/neutrino.js +356 -0
- package/package.json +60 -0
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
export default function getLayers(option) {
|
|
3
|
+
const { languageSuffix } = option;
|
|
4
|
+
return [
|
|
5
|
+
// background
|
|
6
|
+
{ id: 'background', type: 'background' },
|
|
7
|
+
// ocean
|
|
8
|
+
{ id: 'water-ocean', type: 'fill', 'source-layer': 'ocean' },
|
|
9
|
+
// land
|
|
10
|
+
{
|
|
11
|
+
id: 'land-glacier',
|
|
12
|
+
type: 'fill', 'source-layer': 'water_polygons',
|
|
13
|
+
filter: ['all', ['==', 'kind', 'glacier']],
|
|
14
|
+
},
|
|
15
|
+
...[
|
|
16
|
+
{ id: 'commercial', kinds: ['commercial', 'retail'] },
|
|
17
|
+
{ id: 'industrial', kinds: ['industrial', 'quarry', 'railway'] },
|
|
18
|
+
{ id: 'residential', kinds: ['garages', 'residential'] },
|
|
19
|
+
{ id: 'agriculture', kinds: ['brownfield', 'farmland', 'farmyard', 'greenfield', 'greenhouse_horticulture', 'orchard', 'plant_nursery', 'vineyard'] },
|
|
20
|
+
{ id: 'waste', kinds: ['landfill'] },
|
|
21
|
+
{ id: 'park', kinds: ['park', 'village_green', 'recreation_ground'] },
|
|
22
|
+
{ id: 'garden', kinds: ['allotments', 'garden'] },
|
|
23
|
+
{ id: 'burial', kinds: ['cemetery', 'grave_yard'] },
|
|
24
|
+
{ id: 'leisure', kinds: ['miniature_golf', 'playground', 'golf_course'] },
|
|
25
|
+
{ id: 'rock', kinds: ['bare_rock', 'scree', 'shingle'] },
|
|
26
|
+
{ id: 'forest', kinds: ['forest'] },
|
|
27
|
+
{ id: 'grass', kinds: ['grass', 'grassland', 'meadow', 'wet_meadow'] },
|
|
28
|
+
{ id: 'vegetation', kinds: ['heath', 'scrub'] },
|
|
29
|
+
{ id: 'sand', kinds: ['beach', 'sand'] },
|
|
30
|
+
{ id: 'wetland', kinds: ['bog', 'marsh', 'string_bog', 'swamp'] },
|
|
31
|
+
].map(({ id, kinds }) => ({
|
|
32
|
+
id: 'land-' + id,
|
|
33
|
+
type: 'fill',
|
|
34
|
+
'source-layer': 'land',
|
|
35
|
+
filter: ['all',
|
|
36
|
+
['in', 'kind', ...kinds],
|
|
37
|
+
],
|
|
38
|
+
})),
|
|
39
|
+
// water-lines
|
|
40
|
+
...['river', 'canal', 'stream', 'ditch'].map((t) => ({
|
|
41
|
+
id: 'water-' + t,
|
|
42
|
+
type: 'line',
|
|
43
|
+
'source-layer': 'water_lines',
|
|
44
|
+
filter: ['all',
|
|
45
|
+
['in', 'kind', t],
|
|
46
|
+
['!=', 'tunnel', true],
|
|
47
|
+
['!=', 'bridge', true],
|
|
48
|
+
],
|
|
49
|
+
})),
|
|
50
|
+
// water polygons
|
|
51
|
+
{
|
|
52
|
+
id: 'water-area',
|
|
53
|
+
type: 'fill', 'source-layer': 'water_polygons',
|
|
54
|
+
filter: ['==', 'kind', 'water'],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'water-area-river',
|
|
58
|
+
type: 'fill', 'source-layer': 'water_polygons',
|
|
59
|
+
filter: ['==', 'kind', 'river'],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'water-area-small',
|
|
63
|
+
type: 'fill', 'source-layer': 'water_polygons',
|
|
64
|
+
filter: ['in', 'kind', 'reservoir', 'basin', 'dock'],
|
|
65
|
+
},
|
|
66
|
+
// dam
|
|
67
|
+
{ id: 'water-dam-area', type: 'fill', 'source-layer': 'dam_polygons', filter: ['==', 'kind', 'dam'] },
|
|
68
|
+
{ id: 'water-dam', type: 'line', 'source-layer': 'dam_lines', filter: ['==', 'kind', 'dam'] },
|
|
69
|
+
// pier
|
|
70
|
+
{ id: 'water-pier-area', type: 'fill', 'source-layer': 'pier_polygons', filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'] },
|
|
71
|
+
{ id: 'water-pier', type: 'line', 'source-layer': 'pier_lines', filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'] },
|
|
72
|
+
// site
|
|
73
|
+
...['danger_area', 'sports_center', 'university', 'college', 'school', 'hospital', 'prison', 'parking', 'bicycle_parking', 'construction'].map((t) => ({
|
|
74
|
+
id: 'site-' + t.replace(/_/g, ''),
|
|
75
|
+
type: 'fill',
|
|
76
|
+
'source-layer': 'sites',
|
|
77
|
+
filter: ['in', 'kind', t],
|
|
78
|
+
})),
|
|
79
|
+
// airport
|
|
80
|
+
{
|
|
81
|
+
id: 'airport-area',
|
|
82
|
+
type: 'fill', 'source-layer': 'street_polygons', filter: ['in', 'kind', 'runway', 'taxiway'],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'airport-taxiway:outline',
|
|
86
|
+
type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'taxiway'],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'airport-runway:outline',
|
|
90
|
+
type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'runway'],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'airport-taxiway',
|
|
94
|
+
type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'taxiway'],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'airport-runway',
|
|
98
|
+
type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'runway'],
|
|
99
|
+
},
|
|
100
|
+
// building
|
|
101
|
+
{
|
|
102
|
+
id: 'building:outline',
|
|
103
|
+
type: 'fill', 'source-layer': 'buildings',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'building',
|
|
107
|
+
type: 'fill', 'source-layer': 'buildings',
|
|
108
|
+
},
|
|
109
|
+
// tunnel-, street-, bridges-bridge
|
|
110
|
+
...['tunnel', 'street', 'bridge'].flatMap((c) => {
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/init-declarations
|
|
112
|
+
let filter, prefix;
|
|
113
|
+
const results = [];
|
|
114
|
+
switch (c) {
|
|
115
|
+
case 'tunnel':
|
|
116
|
+
filter = [['==', 'tunnel', true]];
|
|
117
|
+
prefix = 'tunnel-';
|
|
118
|
+
break;
|
|
119
|
+
case 'street':
|
|
120
|
+
filter = [['!=', 'bridge', true], ['!=', 'tunnel', true]];
|
|
121
|
+
prefix = '';
|
|
122
|
+
break;
|
|
123
|
+
case 'bridge':
|
|
124
|
+
filter = [['==', 'bridge', true]];
|
|
125
|
+
prefix = 'bridge-';
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
// bridges, above street, below bridge
|
|
129
|
+
if (c === 'bridge')
|
|
130
|
+
results.push({
|
|
131
|
+
id: 'bridge',
|
|
132
|
+
type: 'fill',
|
|
133
|
+
'source-layer': 'bridges',
|
|
134
|
+
});
|
|
135
|
+
[':outline', ''].forEach(suffix => {
|
|
136
|
+
// pedestrian zone — no outline
|
|
137
|
+
if (suffix === ':outline')
|
|
138
|
+
results.push({
|
|
139
|
+
id: prefix + 'street-pedestrian-zone',
|
|
140
|
+
type: 'fill',
|
|
141
|
+
'source-layer': 'street_polygons',
|
|
142
|
+
filter: ['all',
|
|
143
|
+
['==', 'kind', 'pedestrian'],
|
|
144
|
+
...filter,
|
|
145
|
+
],
|
|
146
|
+
});
|
|
147
|
+
// non-car streets
|
|
148
|
+
['footway', 'steps', 'path', 'cycleway'].forEach(t => {
|
|
149
|
+
results.push({
|
|
150
|
+
id: prefix + 'way-' + t.replace(/_/g, '') + suffix,
|
|
151
|
+
type: 'line',
|
|
152
|
+
'source-layer': 'streets',
|
|
153
|
+
filter: ['all',
|
|
154
|
+
['in', 'kind', t],
|
|
155
|
+
...filter,
|
|
156
|
+
],
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
// no links
|
|
160
|
+
['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach(t => {
|
|
161
|
+
results.push({
|
|
162
|
+
id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
|
|
163
|
+
type: 'line',
|
|
164
|
+
'source-layer': 'streets',
|
|
165
|
+
filter: ['all',
|
|
166
|
+
['==', 'kind', t],
|
|
167
|
+
...filter,
|
|
168
|
+
...(t === 'service') ? [['!=', 'service', 'driveway']] : [], // ignore driveways
|
|
169
|
+
],
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
// no links, bicycle=designated
|
|
173
|
+
if (suffix === '')
|
|
174
|
+
['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach(t => {
|
|
175
|
+
results.push({
|
|
176
|
+
id: prefix + 'street-' + t.replace(/_/g, '') + '-bicycle',
|
|
177
|
+
type: 'line',
|
|
178
|
+
'source-layer': 'streets',
|
|
179
|
+
filter: ['all',
|
|
180
|
+
['==', 'kind', t],
|
|
181
|
+
['==', 'bicycle', 'designated'],
|
|
182
|
+
...filter,
|
|
183
|
+
...(t === 'service') ? [['!=', 'service', 'driveway']] : [], // ignore driveways
|
|
184
|
+
],
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
// links
|
|
188
|
+
['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach(t => {
|
|
189
|
+
results.push({
|
|
190
|
+
id: prefix + 'street-' + t.replace(/_/g, '') + '-link' + suffix,
|
|
191
|
+
type: 'line',
|
|
192
|
+
'source-layer': 'streets',
|
|
193
|
+
filter: ['all',
|
|
194
|
+
['in', 'kind', t],
|
|
195
|
+
['==', 'link', true],
|
|
196
|
+
...filter,
|
|
197
|
+
],
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
// main
|
|
201
|
+
['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach(t => {
|
|
202
|
+
results.push({
|
|
203
|
+
id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
|
|
204
|
+
type: 'line',
|
|
205
|
+
'source-layer': 'streets',
|
|
206
|
+
filter: ['all',
|
|
207
|
+
['in', 'kind', t],
|
|
208
|
+
['!=', 'link', true],
|
|
209
|
+
...filter,
|
|
210
|
+
],
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
// separate outline for trains
|
|
215
|
+
[':outline', ''].forEach(suffix => {
|
|
216
|
+
// transport
|
|
217
|
+
['rail', 'light_rail', 'subway', 'narrow_gauge', 'tram', 'funicular', 'monorail', 'bus_guideway', 'busway'].reverse().forEach((t) => {
|
|
218
|
+
results.push({
|
|
219
|
+
id: prefix + 'transport-' + t.replace(/_/g, '') + suffix,
|
|
220
|
+
type: 'line',
|
|
221
|
+
'source-layer': 'streets',
|
|
222
|
+
filter: ['all',
|
|
223
|
+
['in', 'kind', t],
|
|
224
|
+
['!has', 'service'],
|
|
225
|
+
...filter,
|
|
226
|
+
],
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
if (c === 'street') {
|
|
230
|
+
// aerialway, no bridges, above street evel
|
|
231
|
+
['cable_car', 'gondola', 'goods', 'chair_lift', 'drag_lift', 't-bar', 'j-bar', 'platter', 'rope-tow'].reverse().forEach((t) => {
|
|
232
|
+
results.push({
|
|
233
|
+
id: 'aerialway-' + t.replace(/[_-]+/g, '') + suffix,
|
|
234
|
+
type: 'line',
|
|
235
|
+
'source-layer': 'aerialways',
|
|
236
|
+
filter: ['all',
|
|
237
|
+
['in', 'kind', t],
|
|
238
|
+
...filter,
|
|
239
|
+
],
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
// ferry — only on street level
|
|
243
|
+
results.push({
|
|
244
|
+
id: 'transport-ferry' + suffix,
|
|
245
|
+
type: 'line',
|
|
246
|
+
'source-layer': 'ferries',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
return results;
|
|
251
|
+
}),
|
|
252
|
+
// poi, one layer per type
|
|
253
|
+
...['amenity', 'leisure', 'tourism', 'shop', 'man_made', 'historic', 'emergency', 'highway', 'office'].map((key) => ({
|
|
254
|
+
id: 'poi-' + key,
|
|
255
|
+
type: 'symbol',
|
|
256
|
+
'source-layer': 'pois',
|
|
257
|
+
filter: ['!=', key, ''],
|
|
258
|
+
})),
|
|
259
|
+
// boundary
|
|
260
|
+
...[':outline', ''].flatMap((suffix) => [
|
|
261
|
+
{
|
|
262
|
+
id: 'boundary-country' + suffix,
|
|
263
|
+
type: 'line',
|
|
264
|
+
'source-layer': 'boundaries',
|
|
265
|
+
filter: ['all',
|
|
266
|
+
['==', 'admin_level', 2],
|
|
267
|
+
['!=', 'maritime', true],
|
|
268
|
+
['!=', 'disputed', true],
|
|
269
|
+
['!=', 'coastline', true],
|
|
270
|
+
],
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
id: 'boundary-country-disputed' + suffix,
|
|
274
|
+
type: 'line',
|
|
275
|
+
'source-layer': 'boundaries',
|
|
276
|
+
filter: ['all',
|
|
277
|
+
['==', 'admin_level', 2],
|
|
278
|
+
['==', 'disputed', true],
|
|
279
|
+
['!=', 'maritime', true],
|
|
280
|
+
['!=', 'coastline', true],
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
id: 'boundary-country-maritime' + suffix,
|
|
285
|
+
type: 'line',
|
|
286
|
+
'source-layer': 'boundaries',
|
|
287
|
+
filter: ['all',
|
|
288
|
+
['==', 'admin_level', 2],
|
|
289
|
+
['==', 'maritime', true],
|
|
290
|
+
['!=', 'disputed', true],
|
|
291
|
+
['!=', 'coastline', true],
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: 'boundary-state' + suffix,
|
|
296
|
+
type: 'line',
|
|
297
|
+
'source-layer': 'boundaries',
|
|
298
|
+
filter: ['all',
|
|
299
|
+
['==', 'admin_level', 4],
|
|
300
|
+
['!=', 'maritime', true],
|
|
301
|
+
['!=', 'disputed', true],
|
|
302
|
+
['!=', 'coastline', true],
|
|
303
|
+
],
|
|
304
|
+
},
|
|
305
|
+
]),
|
|
306
|
+
// label-address
|
|
307
|
+
{
|
|
308
|
+
id: 'label-address-housenumber',
|
|
309
|
+
type: 'symbol',
|
|
310
|
+
'source-layer': 'addresses',
|
|
311
|
+
filter: ['has', 'housenumber'],
|
|
312
|
+
layout: { 'text-field': '{housenumber}' },
|
|
313
|
+
},
|
|
314
|
+
// label-motorway
|
|
315
|
+
{
|
|
316
|
+
id: 'label-motorway-exit',
|
|
317
|
+
type: 'symbol',
|
|
318
|
+
'source-layer': 'street_labels_points',
|
|
319
|
+
filter: ['==', 'kind', 'motorway_junction'],
|
|
320
|
+
layout: { 'text-field': '{ref}' },
|
|
321
|
+
// FIXME shield
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: 'label-motorway-shield',
|
|
325
|
+
type: 'symbol',
|
|
326
|
+
'source-layer': 'street_labels',
|
|
327
|
+
filter: ['==', 'kind', 'motorway'],
|
|
328
|
+
layout: { 'text-field': '{ref}' },
|
|
329
|
+
// FIXME shield
|
|
330
|
+
},
|
|
331
|
+
// label-street
|
|
332
|
+
...['pedestrian', 'living_street', 'residential', 'unclassified', 'tertiary', 'secondary', 'primary', 'trunk'].map((t) => ({
|
|
333
|
+
id: 'label-street-' + t.replace(/_/g, ''),
|
|
334
|
+
type: 'symbol',
|
|
335
|
+
'source-layer': 'street_labels',
|
|
336
|
+
filter: ['==', 'kind', t],
|
|
337
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
338
|
+
})),
|
|
339
|
+
// label-place of small places
|
|
340
|
+
...[/*'locality', 'island', 'farm', 'dwelling',*/ 'neighbourhood', 'quarter', 'suburb', 'hamlet', 'village', 'town'].map((id) => ({
|
|
341
|
+
id: 'label-place-' + id.replace(/_/g, ''),
|
|
342
|
+
type: 'symbol',
|
|
343
|
+
'source-layer': 'place_labels',
|
|
344
|
+
filter: ['==', 'kind', id],
|
|
345
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
346
|
+
})),
|
|
347
|
+
// label-boundary
|
|
348
|
+
{
|
|
349
|
+
id: 'label-boundary-state',
|
|
350
|
+
type: 'symbol',
|
|
351
|
+
'source-layer': 'boundary_labels',
|
|
352
|
+
filter: ['in', 'admin_level', 4, '4'],
|
|
353
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
354
|
+
},
|
|
355
|
+
// label-place-* of large places
|
|
356
|
+
...['city', 'state_capital', 'capital'].map((id) => ({
|
|
357
|
+
id: 'label-place-' + id.replace(/_/g, ''),
|
|
358
|
+
type: 'symbol',
|
|
359
|
+
'source-layer': 'place_labels',
|
|
360
|
+
filter: ['==', 'kind', id],
|
|
361
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
362
|
+
})),
|
|
363
|
+
{
|
|
364
|
+
id: 'label-boundary-country-small',
|
|
365
|
+
type: 'symbol',
|
|
366
|
+
'source-layer': 'boundary_labels',
|
|
367
|
+
filter: ['all',
|
|
368
|
+
['in', 'admin_level', 2, '2'],
|
|
369
|
+
['<=', 'way_area', 10000000],
|
|
370
|
+
],
|
|
371
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
id: 'label-boundary-country-medium',
|
|
375
|
+
type: 'symbol',
|
|
376
|
+
'source-layer': 'boundary_labels',
|
|
377
|
+
filter: ['all',
|
|
378
|
+
['in', 'admin_level', 2, '2'],
|
|
379
|
+
['<', 'way_area', 90000000],
|
|
380
|
+
['>', 'way_area', 10000000],
|
|
381
|
+
],
|
|
382
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
id: 'label-boundary-country-large',
|
|
386
|
+
type: 'symbol',
|
|
387
|
+
'source-layer': 'boundary_labels',
|
|
388
|
+
filter: ['all',
|
|
389
|
+
['in', 'admin_level', 2, '2'],
|
|
390
|
+
['>=', 'way_area', 90000000],
|
|
391
|
+
],
|
|
392
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
393
|
+
},
|
|
394
|
+
// marking
|
|
395
|
+
{
|
|
396
|
+
id: 'marking-oneway',
|
|
397
|
+
type: 'symbol',
|
|
398
|
+
'source-layer': 'streets',
|
|
399
|
+
filter: ['all',
|
|
400
|
+
['==', 'oneway', true],
|
|
401
|
+
['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
|
|
402
|
+
],
|
|
403
|
+
layout: {
|
|
404
|
+
'symbol-placement': 'line',
|
|
405
|
+
'symbol-spacing': 175,
|
|
406
|
+
'icon-rotate': 90,
|
|
407
|
+
'icon-rotation-alignment': 'map',
|
|
408
|
+
'icon-padding': 5,
|
|
409
|
+
'symbol-avoid-edges': true,
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: 'marking-oneway-reverse',
|
|
414
|
+
type: 'symbol',
|
|
415
|
+
'source-layer': 'streets',
|
|
416
|
+
filter: ['all',
|
|
417
|
+
['==', 'oneway_reverse', true],
|
|
418
|
+
['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
|
|
419
|
+
],
|
|
420
|
+
layout: {
|
|
421
|
+
'symbol-placement': 'line',
|
|
422
|
+
'symbol-spacing': 75,
|
|
423
|
+
'icon-rotate': -90,
|
|
424
|
+
'icon-rotation-alignment': 'map',
|
|
425
|
+
'icon-padding': 5,
|
|
426
|
+
'symbol-avoid-edges': true,
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
id: 'marking-bicycle',
|
|
431
|
+
type: 'symbol',
|
|
432
|
+
'source-layer': 'streets',
|
|
433
|
+
filter: ['all',
|
|
434
|
+
['==', 'bicycle', 'designated'],
|
|
435
|
+
['==', 'kind', 'cycleway'],
|
|
436
|
+
],
|
|
437
|
+
layout: {
|
|
438
|
+
'symbol-placement': 'line',
|
|
439
|
+
'symbol-spacing': 50,
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
// symbol
|
|
443
|
+
{
|
|
444
|
+
id: 'symbol-transit-bus',
|
|
445
|
+
type: 'symbol',
|
|
446
|
+
'source-layer': 'public_transport',
|
|
447
|
+
filter: ['==', 'kind', 'bus_stop'],
|
|
448
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
id: 'symbol-transit-tram',
|
|
452
|
+
type: 'symbol',
|
|
453
|
+
'source-layer': 'public_transport',
|
|
454
|
+
filter: ['==', 'kind', 'tram_stop'],
|
|
455
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
id: 'symbol-transit-subway',
|
|
459
|
+
type: 'symbol',
|
|
460
|
+
'source-layer': 'public_transport',
|
|
461
|
+
filter: ['all',
|
|
462
|
+
['in', 'kind', 'station', 'halt'],
|
|
463
|
+
['==', 'station', 'subway'],
|
|
464
|
+
],
|
|
465
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
id: 'symbol-transit-lightrail',
|
|
469
|
+
type: 'symbol',
|
|
470
|
+
'source-layer': 'public_transport',
|
|
471
|
+
filter: ['all',
|
|
472
|
+
['in', 'kind', 'station', 'halt'],
|
|
473
|
+
['==', 'station', 'light_rail'],
|
|
474
|
+
],
|
|
475
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
id: 'symbol-transit-station',
|
|
479
|
+
type: 'symbol',
|
|
480
|
+
'source-layer': 'public_transport',
|
|
481
|
+
filter: ['all',
|
|
482
|
+
['in', 'kind', 'station', 'halt'],
|
|
483
|
+
['!in', 'station', 'light_rail', 'subway'],
|
|
484
|
+
],
|
|
485
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
id: 'symbol-transit-airfield',
|
|
489
|
+
type: 'symbol',
|
|
490
|
+
'source-layer': 'public_transport',
|
|
491
|
+
filter: ['all',
|
|
492
|
+
['==', 'kind', 'aerodrome'],
|
|
493
|
+
['!has', 'iata'],
|
|
494
|
+
],
|
|
495
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
id: 'symbol-transit-airport',
|
|
499
|
+
type: 'symbol',
|
|
500
|
+
'source-layer': 'public_transport',
|
|
501
|
+
filter: ['all',
|
|
502
|
+
['==', 'kind', 'aerodrome'],
|
|
503
|
+
['has', 'iata'],
|
|
504
|
+
],
|
|
505
|
+
layout: { 'text-field': `{name${languageSuffix}}` },
|
|
506
|
+
},
|
|
507
|
+
];
|
|
508
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import getLayers from './layers.js';
|
|
2
|
+
describe('layers', () => {
|
|
3
|
+
it('should return an array of MaplibreLayer', () => {
|
|
4
|
+
const languageSuffix = '_en';
|
|
5
|
+
const layers = getLayers({ languageSuffix });
|
|
6
|
+
expect(Array.isArray(layers)).toBe(true);
|
|
7
|
+
expect(layers).not.toHaveLength(0);
|
|
8
|
+
layers.forEach((layer) => {
|
|
9
|
+
expect(layer).toHaveProperty('id');
|
|
10
|
+
expect(layer).toHaveProperty('type');
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
it('should handle language suffix correctly', () => {
|
|
14
|
+
const languageSuffix = '_en';
|
|
15
|
+
const layers = getLayers({ languageSuffix });
|
|
16
|
+
const labelLayer = layers.find((layer) => layer.id === 'label-street-pedestrian');
|
|
17
|
+
expect(labelLayer).toBeDefined();
|
|
18
|
+
expect(labelLayer.layout?.['text-field']).toContain('{name_en}');
|
|
19
|
+
});
|
|
20
|
+
it('should create appropriate filters for land layers', () => {
|
|
21
|
+
const languageSuffix = '_en';
|
|
22
|
+
const layers = getLayers({ languageSuffix });
|
|
23
|
+
const landLayer = layers.find((layer) => layer.id === 'land-agriculture');
|
|
24
|
+
expect(landLayer).toBeDefined();
|
|
25
|
+
expect(landLayer?.filter).toEqual(['all', ['in', 'kind', 'brownfield', 'farmland', 'farmyard', 'greenfield', 'greenhouse_horticulture', 'orchard', 'plant_nursery', 'vineyard']]);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ShortbreadProperty {
|
|
2
|
+
readonly key: string;
|
|
3
|
+
readonly parent: 'layer' | 'layout' | 'paint';
|
|
4
|
+
readonly valueType: 'array' | 'boolean' | 'color' | 'enum' | 'filter' | 'fonts' | 'formatted' | 'number' | 'padding' | 'resolvedImage' | 'variableAnchorOffsetCollection';
|
|
5
|
+
}
|
|
6
|
+
declare const propertyLookup: Map<string, ShortbreadProperty[]>;
|
|
7
|
+
export default propertyLookup;
|