-
Notifications
You must be signed in to change notification settings - Fork 120
/
queries.yaml
600 lines (582 loc) · 19.7 KB
/
queries.yaml
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
all:
- water
- earth
- places
- landuse
- roads
- buildings
- pois
- boundaries
- transit
layers:
water:
template: water.jinja2
start_zoom: 0
geometry_types: [Point, MultiPoint, Polygon, MultiPolygon, LineString, MultiLineString]
simplify_before_intersect: true
simplify_start: 9
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.tags_remove
- vectordatasource.transform.water_tunnel
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.water
area-inclusion-threshold: 1
earth:
template: earth.jinja2
start_zoom: 0
geometry_types: [Point, MultiPoint, Polygon, MultiPolygon, LineString, MultiLineString]
simplify_before_intersect: true
simplify_start: 9
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.tags_remove
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.earth
area-inclusion-threshold: 1
places:
template: places.jinja2
start_zoom: 0
geometry_types: [Point, MultiPoint]
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.tags_remove
- vectordatasource.transform.place_population_int
- vectordatasource.transform.calculate_default_place_min_zoom
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.places
area-inclusion-threshold: 1
landuse:
template: landuse.jinja2
start_zoom: 4
geometry_types: [Polygon, MultiPolygon, LineString, MultiLineString]
simplify_start: 4
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.tags_remove
- vectordatasource.transform.normalize_tourism_kind
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.normalize_operator_values
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.landuse
area-inclusion-threshold: 1
roads:
template: roads.jinja2
start_zoom: 5
geometry_types: [LineString, MultiLineString]
simplify_start: 8
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.parse_layer_as_float
- vectordatasource.transform.road_classifier
- vectordatasource.transform.road_oneway
- vectordatasource.transform.road_abbreviate_name
- vectordatasource.transform.route_name
- vectordatasource.transform.normalize_aerialways
- vectordatasource.transform.normalize_cycleway
- vectordatasource.transform.add_is_bicycle_related
- vectordatasource.transform.choose_most_important_network
- vectordatasource.transform.road_trim_properties
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.tags_remove
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.roads
area-inclusion-threshold: 1
buildings:
template: buildings.jinja2
start_zoom: 13
clip_factor: 3.0
geometry_types: [Point, MultiPoint, Polygon, MultiPolygon]
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.tags_remove
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.parse_layer_as_float
- vectordatasource.transform.building_height
- vectordatasource.transform.building_min_height
- vectordatasource.transform.synthesize_volume
- vectordatasource.transform.normalize_tourism_kind
- vectordatasource.transform.building_trim_properties
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.buildings
area-inclusion-threshold: 1
pois:
template: pois.jinja2
start_zoom: 4
geometry_types: [Point, MultiPoint, Polygon, MultiPolygon]
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.add_iata_code_to_airports
- vectordatasource.transform.normalize_tourism_kind
- vectordatasource.transform.normalize_social_kind
- vectordatasource.transform.normalize_medical_kind
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.add_uic_ref
- vectordatasource.transform.tags_remove
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.remove_zero_area
- vectordatasource.transform.make_representative_point
- vectordatasource.transform.height_to_meters
- vectordatasource.transform.pois_capacity_int
- vectordatasource.transform.elevation_to_meters
- vectordatasource.transform.normalize_operator_values
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.pois
area-inclusion-threshold: 1
boundaries:
template: boundaries.jinja2
start_zoom: 0
geometry_types: [Polygon, MultiPolygon, LineString, MultiLineString]
simplify_before_intersect: true
simplify_start: 8
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.tags_remove
- vectordatasource.transform.admin_level_as_int
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.truncate_min_zoom_to_2dp
area-inclusion-threshold: 1
transit:
template: transit.jinja2
start_zoom: 5
geometry_types: [LineString, MultiLineString, Polygon, MultiPolygon]
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.tags_name_i18n
- vectordatasource.transform.add_uic_ref
- vectordatasource.transform.tags_remove
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.route_name
- vectordatasource.transform.parse_layer_as_float
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.transit
area-inclusion-threshold: 1
post_process:
- fn: vectordatasource.transform.numeric_min_filter
params:
source_layer: buildings
mode: any
filters:
13: { area: 1600, volume: 300000 }
14: { area: 100, volume: 200000 }
15: { area: 100, volume: 100000 }
- fn: vectordatasource.transform.build_fence
params:
base_layer: landuse
start_zoom: 16
prop_transform:
kind: true
id: true
source: true
area: true
min_zoom: true
- fn: vectordatasource.transform.drop_properties
params:
source_layer: landuse
start_zoom: 4
properties: [barrier]
# sort key
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/sort_key/landuse.csv
params:
source_layer: landuse
target_value_type: int
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/sort_key/roads.csv
params:
source_layer: roads
target_value_type: int
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/sort_key/earth.csv
params:
source_layer: earth
target_value_type: int
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/sort_key/boundaries.csv
params:
source_layer: boundaries
target_value_type: int
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/sort_key/buildings.csv
params:
source_layer: buildings
target_value_type: int
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/sort_key/transit.csv
params:
source_layer: transit
target_value_type: int
# this needs to run before the water sort_key csv matcher
- fn: vectordatasource.transform.exterior_boundaries
params:
base_layer: water
start_zoom: 9
prop_transform:
kind: true
id: true
source: true
boundary: [true]
area: true
snap_tolerance: 0.125
# have to do the water properties matching _after_ exterior boundaries
# as it depends on having the "boundary: yes" property available.
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/sort_key/water.csv
params:
source_layer: water
target_value_type: int
# assign `scale_rank`
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/scale_rank/buildings.csv
params:
source_layer: buildings
target_value_type: int
# drop all polygonal features that don't meet the minimum area
# threshold. this depends on the mz_min_pixels property to be set on
# features first
- fn: vectordatasource.transform.drop_features_mz_min_pixels
params:
property: mz_min_pixels
source_layers:
# all layers that have polygonal geometries
- boundaries
- buildings
- earth
- landuse
- transit
- water
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
properties: [layer]
- fn: vectordatasource.transform.overlap
params:
base_layer: buildings
cutting_layer: landuse
attribute: kind
target_attribute: landuse_kind
cutting_attrs: { sort_key: 'sort_key', reverse: True }
- fn: vectordatasource.transform.admin_boundaries
params:
base_layer: boundaries
start_zoom: 8
- fn: vectordatasource.transform.handle_label_placement
params:
layers:
- water
- earth
location_property: mz_label_placement
label_property_name: label_placement
label_property_value: true
label_where: >-
'name' in properties
- fn: vectordatasource.transform.handle_label_placement
params:
layers:
- landuse
start_zoom: 15
location_property: mz_label_placement
label_property_name: label_placement
label_property_value: true
label_where: >-
'name' in properties or
('sport' in properties and properties.get('kind', 'rock') not in ('rock', 'stone'))
# drop mz_label placement at zooms we don't apply handle_label_placement
- fn: vectordatasource.transform.drop_properties
params:
source_layer: landuse
start_zoom: 0
end_zoom: 14
properties: [mz_label_placement]
geom_types: [Polygon, MultiPolygon]
- fn: vectordatasource.transform.handle_label_placement
params:
layers:
- buildings
start_zoom: 16
location_property: mz_label_placement
label_property_name: label_placement
label_property_value: true
label_where: >-
'name' in properties
# drop mz_label placement at zooms we don't apply handle_label_placement
- fn: vectordatasource.transform.drop_properties
params:
source_layer: buildings
start_zoom: 0
end_zoom: 15
properties: [mz_label_placement]
geom_types: [Polygon, MultiPolygon]
- fn: vectordatasource.transform.remove_duplicate_features
params:
source_layer: landuse
end_zoom: 15
property_keys: [name, kind]
geometry_types: [Point]
min_distance: 256.0
# drop the names and less important additional tags of small landuse polygons
- fn: vectordatasource.transform.drop_properties
params:
source_layer: landuse
start_zoom: 4
end_zoom: 12
properties: [name, sport, religion, surface]
where: >-
pixel_area > area
geom_types: [Polygon, MultiPolygon]
# merge any remaining polygons by their properties.
- fn: vectordatasource.transform.merge_polygon_features
params:
source_layer: landuse
start_zoom: 4
end_zoom: 12
- fn: vectordatasource.transform.drop_features_where
params:
source_layer: water
start_zoom: 3
where: >-
'label_placement' not in properties and kind in ('sea', 'bay', 'strait', 'fjord')
- fn: vectordatasource.transform.drop_features_where
params:
source_layer: earth
start_zoom: 0
where: >-
'label_placement' not in properties and kind in
('archipelago', 'island', 'islet', 'continent', 'valley', 'ridge')
- fn: vectordatasource.transform.generate_address_points
params:
source_layer: buildings
start_zoom: 16
- fn: vectordatasource.transform.remove_duplicate_features
params:
source_layer: buildings
end_zoom: 15
property_keys: [name, kind]
geometry_types: [Point]
min_distance: 256.0
- fn: vectordatasource.transform.remove_duplicate_features
params:
source_layer: pois
end_zoom: 15
property_keys: [name, kind]
geometry_types: [Point]
min_distance: 256.0
- fn: vectordatasource.transform.drop_features_where
params:
source_layer: landuse
start_zoom: 6
where: >-
properties.get('mz_is_building') is True and
properties.get('label_placement') is None
- fn: vectordatasource.transform.merge_duplicate_stations
params:
source_layer: pois
end_zoom: 15
- fn: vectordatasource.transform.normalize_station_properties
params:
source_layer: pois
- fn: vectordatasource.transform.rank_features
params:
source_layer: pois
items_matching:
kind: station
rank_key: kind_tile_rank
- fn: vectordatasource.transform.rank_features
params:
source_layer: places
items_matching:
kind: [neighbourhood, microhood, macrohood]
rank_key: kind_tile_rank
start_zoom: 11
- fn: vectordatasource.transform.rank_features
params:
source_layer: pois
items_matching:
kind: [peak, volcano]
rank_key: kind_tile_rank
start_zoom: 9
- fn: vectordatasource.transform.remove_duplicate_features
params:
source_layers: [pois, landuse, buildings]
end_zoom: 15
property_keys: [name]
geometry_types: [Point]
min_distance: 64.0
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 14
properties: [is_bridge, is_tunnel]
where: >-
(kind == 'path' and zoom < 15) or
(kind in ['minor_road', 'major_road', 'highway', 'rail'] and zoom < 13)
# drop certain road properties at lower zooms
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 14
properties: [oneway, crossing, sidewalk, sidewalk_left, sidewalk_right]
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 14
properties: [name, ref, network, shield_text, all_networks, all_shield_texts]
where: >-
(kind == 'rail' and zoom < 15) or
(kind == 'minor_road' and zoom < 14) or
(kind == 'major_road' and zoom < 7) or
(kind == 'highway' and zoom < 7)
# this is a patch because we still want to drop name, network from major_road
# features between zoom 7 and 10
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 7
end_zoom: 10
properties: [name, all_networks, all_shield_texts]
where: >-
kind == 'major_road'
# this is a patch to get rid of name, but keep ref & network, for highways
# when zoom < 11.
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 7
end_zoom: 10
properties: [name]
where: >-
kind == 'highway'
- fn: vectordatasource.transform.update_parenthetical_properties
params:
source_layer: pois
values: ['closed', 'historical']
target_min_zoom: 17
drop_below_zoom: 16
- fn: vectordatasource.transform.update_parenthetical_properties
params:
source_layer: buildings
values: ['closed', 'historical']
target_min_zoom: 17
drop_below_zoom: 16
- fn: vectordatasource.transform.merge_line_features
params:
source_layer: transit
start_zoom: 0
end_zoom: 15
# only keep all stations below z12, then cut it down to the top few.
- fn: vectordatasource.transform.keep_n_features
params:
source_layer: transit
start_zoom: 9
end_zoom: 11
items_matching: { kind: station }
max_items: 20
- fn: vectordatasource.transform.keep_n_features
params:
source_layer: transit
start_zoom: 12
end_zoom: 13
items_matching: { kind: station }
max_items: 30
- fn: vectordatasource.transform.keep_n_features
params:
source_layer: pois
start_zoom: 9
end_zoom: 15
items_matching: { kind: [peak, volcano] }
max_items: 5
- fn: vectordatasource.transform.drop_properties_with_prefix
params: {prefix: mz_}
- fn: vectordatasource.transform.merge_building_features
params:
source_layer: buildings
start_zoom: 13
end_zoom: 14
quantize:
13: vectordatasource.transform.quantize_height_round_nearest_10_meters
14: vectordatasource.transform.quantize_height_round_nearest_5_meters
drop:
- name
- addr_housenumber
- addr_street
- fn: vectordatasource.transform.simplify_and_clip
params: {simplify_before: 16}
- fn: vectordatasource.transform.intercut
params:
base_layer: roads
cutting_layer: landuse
attribute: kind
target_attribute: landuse_kind
cutting_attrs: { sort_key: 'sort_key', reverse: True }
- fn: vectordatasource.transform.merge_line_features
params:
source_layer: roads
start_zoom: 8
end_zoom: 15
- fn: vectordatasource.transform.buildings_unify
params:
source_layer: buildings
start_zoom: 15