-
Notifications
You must be signed in to change notification settings - Fork 120
/
queries.yaml
1812 lines (1698 loc) · 56.1 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
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
all:
- water
- earth
- places
- landuse
- roads
- buildings
- pois
- boundaries
- transit
- admin_areas
sources:
# NOTE: each source represents a query to the database
# within each source, a list of templates can be used
# the templates will be combined with a sql `union all` in between
# therefore, it's necessary that the query results of each template
# have the same types
# NOTE: end_zoom is exclusive
planet_osm_polygon:
- template: planet_osm_polygon.jinja2
# landuse and pois start at 4
start_zoom: 4
planet_osm_line:
- template: planet_osm_line.jinja2
# transit starts at 5
start_zoom: 5
planet_osm_point:
# earth and places start at zoom 0
- template: planet_osm_point.jinja2
ne:
## places
# ne_10m_populated_places
- template: ne-places.jinja2
## boundaries
# ne_110m_admin_0_boundary_lines_land
- template: ne-boundaries-110m.jinja2
end_zoom: 2
# ne_50m_admin_0_boundary_lines_land
# ne_50m_admin_1_states_provinces_lines
- template: ne-boundaries-50m.jinja2
start_zoom: 2
end_zoom: 5
# ne_10m_admin_0_boundary_lines_land
# ne_10m_admin_0_boundary_lines_map_units
# ne_10m_admin_1_states_provinces_lines
- template: ne-boundaries-10m.jinja2
start_zoom: 5
end_zoom: 8
## earth
# ne_110m_land
- template: ne-earth-110m.jinja2
end_zoom: 2
# ne_50m_land
- template: ne-earth-50m.jinja2
start_zoom: 2
end_zoom: 5
# ne_10m_land
- template: ne-earth-10m.jinja2
start_zoom: 5
end_zoom: 8
## landuse
# ne_50m_urban_areas
- template: ne-landuse-50m.jinja2
start_zoom: 4
end_zoom: 6
# ne_10m_urban_areas
- template: ne-landuse-10m.jinja2
start_zoom: 6
end_zoom: 10
## roads
# ne_10m_roads
- template: ne-roads.jinja2
start_zoom: 5
end_zoom: 8
## water
# ne_110m_ocean
# ne_110m_lakes
# ne_110m_coastline
# ne_110m_lakes
- template: ne-water-110m.jinja2
end_zoom: 2
# ne_50m_ocean
# ne_50m_lakes
# ne_50m_coastline
# ne_50m_lakes
- template: ne-water-50m.jinja2
start_zoom: 2
end_zoom: 5
# ne_10m_ocean
# ne_10m_lakes
# ne_10m_coastline
# ne_10m_lakes
- template: ne-water-10m.jinja2
start_zoom: 5
end_zoom: 8
# ne_50m_playas
- template: ne-water-playas-50m.jinja2
start_zoom: 4
end_zoom: 5
# ne_10m_playas
- template: ne-water-playas-10m.jinja2
start_zoom: 5
end_zoom: 8
osmdata:
- template: osmdata-earth.jinja2
start_zoom: 8
- template: osmdata-water.jinja2
start_zoom: 8
wof:
- template: wof.jinja2
start_zoom: 11
admin_areas:
- template: admin_areas.jinja2
# starts at the min zoom where we have road layer data
start_zoom: 5
# note: this goes into the _boundaries_ layer.
buffered_land:
- template: buffered_land.jinja2
start_zoom: 8
layers:
water:
geometry_types: [Point, MultiPoint, 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.water_tunnel
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.detect_osm_relation
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.truncate_min_zoom_to_1dp
sort: vectordatasource.sort.water
area-inclusion-threshold: 1
earth:
geometry_types: [Point, MultiPoint, 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.detect_osm_relation
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.remove_feature_id
- vectordatasource.transform.truncate_min_zoom_to_1dp
sort: vectordatasource.sort.earth
area-inclusion-threshold: 1
places:
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.population_rank
- vectordatasource.transform.capital_alternate_viewpoint
- 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:
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.major_airport_detector
- vectordatasource.transform.truncate_min_zoom_to_2dp
sort: vectordatasource.sort.landuse
area-inclusion-threshold: 1
roads:
geometry_types: [LineString, MultiLineString]
simplify_start: 8
tolerance: 2.0
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.add_road_network_from_ncat
- vectordatasource.transform.add_vehicle_restrictions
- 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:
simplify_before_intersect: yes
area_threshold: 0.0
tolerance: 1.0
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:
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.major_airport_detector
- 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:
geometry_types: [Polygon, MultiPolygon, LineString, MultiLineString]
simplify_before_intersect: true
simplify_start: 8
tolerance: 2.0
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
- vectordatasource.transform.remap_viewpoint_kinds
- vectordatasource.transform.unpack_viewpoint_claims
area-inclusion-threshold: 1
transit:
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
admin_areas:
geometry_types: [Polygon, MultiPolygon]
# note: simplify_* settings shouldn't affect this layer, as it should be
# dropped before we get to that stage. but worth "documenting" that it
# shouldn't be simplified here to make it more explicit.
simplify_before_intersect: false
simplify_start: 999
transform:
- vectordatasource.transform.tags_create_dict
- vectordatasource.transform.add_id_to_properties
- vectordatasource.transform.remove_feature_id
area-inclusion-threshold: 1
post_process:
- 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]
# coarsen the landuse kinds at mid & low zooms to help improve merging.
#
# do this _early_; before we assign sort_rank and to avoid inconsistency when
# we join (e.g: roads) onto landuse and wouldn't want the road landuse_kind to
# be different from the polygon in case that makes it the wrong colour.
#
# **NOTE** WE'RE CHANGING THE KINDS HERE!
- fn: vectordatasource.transform.remap
params:
layer: landuse
start_zoom: 0
end_zoom: 13
property: kind
# don't want to apply this to linear features such as dams?
where: >-
geom_type in ('Polygon', 'MultiPolygon')
# note that we don't need to remap things to themselves, e.g:
# kind=desert stays as-is.
remap:
# aerodrome
airfield: aerodrome
# barren
dam: barren
land: barren
quarry: barren
rock: barren
scree: barren
shingle: barren
stone: barren
# desert
bare_rock: desert
sand: desert
# farmland
farm: farmland
orchard: farmland
plant_nursery: farmland
vineyard: farmland
# forest
natural_wood: forest
wood: forest
# grassland
common: grassland
grass: grassland
heath: grassland
meadow: grassland
scrub: grassland
# military
danger_area: military
range: military
# university
college: university
# urban_area
allotments: urban_area
artwork: urban_area
attraction: urban_area
commercial: urban_area
fort: urban_area
generator: urban_area
industrial: urban_area
pitch: urban_area
place_of_worship: urban_area
plant: urban_area
prison: urban_area
railway: urban_area
residential: urban_area
retail: urban_area
village_green: urban_area
wastewater_plant: urban_area
water_works: urban_area
works: urban_area
# wetland
mud: wetland
# sort key
- fn: vectordatasource.transform.csv_match_properties
resources:
matcher:
type: file
init_fn: vectordatasource.transform.CSVMatcher
path: spreadsheets/sort_rank/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_rank/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_rank/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_rank/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_rank/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_rank/transit.csv
params:
source_layer: transit
target_value_type: int
# this needs to run before the water sort_rank csv matcher
- fn: vectordatasource.transform.exterior_boundaries
params:
base_layer: water
start_zoom: 8
prop_transform:
kind: true
id: true
source: true
boundary: [true]
area: true
intermittent: true
snap_tolerance: 0.125
# the NE water queries pull in the full set of object properties for boundary
# lines, which we don't want. strip them off here.
- fn: vectordatasource.transform.drop_names
params:
source_layer: water
start_zoom: 0
end_zoom: 8
geom_types: [LineString, MultiLineString]
where: >-
kind == 'lake' and boundary
- fn: vectordatasource.transform.drop_properties
params:
source_layer: water
start_zoom: 0
end_zoom: 8
properties: [mz_label_placement]
where: >-
kind == 'lake' and boundary
# 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_rank/water.csv
params:
source_layer: water
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]
# cut with admin_areas to put country_code attributes on roads
# which are mostly within a particular country.
- fn: vectordatasource.transform.overlap
params:
base_layer: roads
cutting_layer: admin_areas
attribute: iso_code
target_attribute: country_code
linear: true
- fn: vectordatasource.transform.road_networks
params:
layer: roads
# having calculated the country_code on roads, now drop it. we don't want it
# in the output (and it's already part of the `network`, if any got added to
# the feature.)
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
properties: [country_code]
- fn: vectordatasource.transform.point_in_country_logic
params:
layer: pois
country_layer: admin_areas
country_code_attr: iso_code
output_attr: drives_on_left
where: kind == 'mini_roundabout'
# see https://en.wikipedia.org/wiki/List_of_countries_with_left-hand_traffic
logic_table:
AG: true # Antigua and Barbuda
AI: true # Anguilla
AU: true # Australia
BB: true # Barbados
BD: true # Bangladesh
BM: true # Bermuda
BN: true # Brunei
BS: true # Bahamas
BT: true # Bhutan
BW: true # Botswana
CC: true # Cocos (Keeling) Islands
CK: true # Cook Islands
CX: true # Christmas Island
CY: true # Cyprus (note, also fake ISO code for Northern Cyprus)
DM: true # Dominica
FJ: true # Fiji
FK: true # Falkland Islands
GB: true # United Kingdom
GD: true # Grenada
GG: true # Guernsey
GS: true # South Georgia and the South Sandwich Islands
GY: true # Guyana
HK: true # Hong Kong
ID: true # Indonesia
IE: true # Ireland
IM: true # Isle of Man
IN: true # India
JE: true # Jersey
JM: true # Jamaica
JP: true # Japan
KE: true # Kenya
KI: true # Kiribati
KN: true # Saint Kitts and Nevis
KY: true # Cayman Islands
LC: true # Saint Lucia
LK: true # Sri Lanka
LS: true # Lesotho
MO: true # Macau (fake ISO code)
MS: true # Montserrat
MT: true # Malta
MU: true # Mauritius
MV: true # Maldives
MW: true # Malawi
MY: true # Malaysia
MZ: true # Mozambique
NA: true # Namibia
NF: true # Norfolk Island
NP: true # Nepal
NR: true # Nauru
NU: true # Niue
NZ: true # New Zealand
PG: true # Papua New Guinea
PK: true # Pakistan
PN: true # Pitcairn Islands
SB: true # Solomon Islands
SC: true # Seychelles
SG: true # Singapore
SH: true # Saint Helena, Ascension and Tristan da Cunha
SR: true # Suriname
SZ: true # Swaziland
TC: true # Turks and Caicos Islands
TH: true # Thailand
TK: true # Tokelau
TL: true # East Timor
TO: true # Tonga
TT: true # Trinidad and Tobago
TV: true # Tuvalu
TZ: true # Tanzania
UG: true # Uganda
VC: true # Saint Vincent and the Grenadines
VG: true # British Virgin Islands
VI: true # U.S. Virgin Islands
WS: true # Samoa
ZA: true # South Africa
ZM: true # Zambia
ZW: true # Zimbabwe
# cut places with admin_areas to put country_code attributes on country,
# state and province points. this is used to backfill information such as
# min and max zoom based on country defaults.
- fn: vectordatasource.transform.point_in_country_logic
resources:
logic_table:
type: file
init_fn: vectordatasource.transform.YAMLToDict
path: spreadsheets/min_zoom/country.yaml
params:
layer: places
country_layer: admin_areas
country_code_attr: iso_code
output_attrs:
- min_zoom
- max_zoom
where: kind == 'country'
- fn: vectordatasource.transform.point_in_country_logic
resources:
logic_table:
type: file
init_fn: vectordatasource.transform.YAMLToDict
path: spreadsheets/min_zoom/state_province.yaml
params:
layer: places
country_layer: admin_areas
country_code_attr: iso_code
output_attrs:
- min_zoom
- max_zoom
where: kind == 'region'
# IMPORTANT! do this _after_ the YAMLToDict default stuff, otherwise the
# default will overwrite the value fron Natural Earth.
- fn: vectordatasource.transform.tags_set_ne_min_max_zoom
params:
layer: places
# after we have the NE min zoom, drop features which we won't be displaying
# at this zoom.
- fn: vectordatasource.transform.min_zoom_filter
params:
layers: [places]
- fn: vectordatasource.transform.overlap
params:
base_layer: buildings
cutting_layer: landuse
attribute: kind
target_attribute: landuse_kind
cutting_attrs: { sort_key: 'sort_rank', reverse: True }
# turn admin polygons (countries, regions, etc...) into oriented boundaries with left/right names.
- fn: vectordatasource.transform.admin_boundaries
params:
base_layer: boundaries
start_zoom: 8
# TODO: document OSM disputed boundary clipping procedure
- fn: vectordatasource.transform.apply_disputed_boundary_viewpoints
params:
base_layer: boundaries
start_zoom: 8
# drop the claimed_by, disputed_by (and any left/right versions) on any
# borders. these should have been projected into kind:xx viewpoints in the
# previous step.
- fn: vectordatasource.transform.drop_properties
params:
source_layer: boundaries
start_zoom: 8
properties:
- claimed_by
- "claimed_by:left"
- "claimed_by:right"
- disputed_by
- "disputed_by:left"
- "disputed_by:right"
# drop id/id:left/id:right on boundaries up to zoom 12 inclusive.
# the left/right IDs tend to be unique as a pair, and so prevent merging.
# the id itself will be dropped by merging if it's possible to merge, and
# at mid and low zooms is of dubious usefulness.
- fn: vectordatasource.transform.drop_properties
params:
source_layer: boundaries
start_zoom: 0
end_zoom: 13
properties:
- id
- "id:left"
- "id:right"
# drop any name on locality boundaries at zooms 11 and 12 (min two zooms).
#
# NOTE: the start_zoom of 11 here comes in because this is the first zoom
# at which we show locality boundaries. if that changes (in boundaries.yaml)
# then it needs to change here, and vice-versa!
- fn: vectordatasource.transform.drop_names
params:
source_layer: boundaries
start_zoom: 11
end_zoom: 13
where: >-
kind == 'locality'
# try to merge boundaries into as long segments as possible.
- fn: vectordatasource.transform.merge_line_features
params:
source_layer: boundaries
start_zoom: 8
end_zoom: 15
# drop labels on boundaries which are too short to render.
- fn: vectordatasource.transform.drop_names_on_short_boundaries
params:
source_layer: boundaries
start_zoom: 8
end_zoom: 11
# pixels (256px nominal) to require per letter in the name. if lines are shorter than this,
# the name gets dropped. name pairs (e.g: :left and :right) get dropped if either are longer
# than pixels_per_letter. larger values mean fewer lines are eligible for labelling.
pixels_per_letter: 11
# drop names on boundary lines (country, region, macroregion) except zoom 7 from Natural Earth
- fn: vectordatasource.transform.drop_names
params:
source_layer: boundaries
start_zoom: 0
end_zoom: 7
# after dropping names, try again to merge boundaries into as few features as
# possible (to reduce tile size).
- fn: vectordatasource.transform.merge_line_features
params:
source_layer: boundaries
start_zoom: 8
end_zoom: 15
# no lake labels at zoom 0-3:
# https://github.com/tilezen/vector-datasource/issues/1730
- fn: vectordatasource.transform.drop_names
params:
source_layer: water
start_zoom: 0
end_zoom: 4
geom_types: [Polygon, MultiPolygon]
where: >-
kind == 'lake'
- 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
# some water polygon features are too small to need a label - and if we label
# them then the label is often so prominent that it hides the polygon it's
# for! see the images here for examples of this:
# https://github.com/tilezen/vector-datasource/issues/1477#issuecomment-447162484
#
# we want to reset min_zoom on these features and screen them out if they
# don't meet minimum sizes per zoom.
- fn: vectordatasource.transform.update_min_zoom
params:
source_layer: water
start_zoom: 4
end_zoom: 16
# the inclusion of "None" in the list might seem odd, but None compares
# numerically smaller than any integer, so acts as a default for this
# table.
min_zoom: >-
[min_zoom for min_zoom, area_threshold in [
(4, 40000000000),
(5, 10000000000),
(6, 5000000000),
(7, 400000000),
(8, 200000000),
(9, 100000000),
(10, 10000000),
(11, 4000000),
(12, 750000),
(13, 100000),
(14, 50000),
(15, 10000),
(16, None),
] if area >= area_threshold][0]
where: >-
kind == 'lake' and label_placement
- 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 any polygon features with mz_drop_polygon
- fn: vectordatasource.transform.drop_features_where
params:
source_layer: landuse
where: >-
properties.get('mz_drop_polygon', False) and
geom_type in ('Polygon', 'MultiPolygon')
# 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: 15
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: 16
properties: [mz_label_placement]
geom_types: [Polygon, MultiPolygon]
- fn: vectordatasource.transform.remove_duplicate_features
params:
source_layer: landuse
end_zoom: 16
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: 13
properties: [name, sport, religion, surface]
where: >-
pixel_area > area
geom_types: [Polygon, MultiPolygon]
- 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')
# merge water and earth polygons, see https://github.com/tilezen/vector-datasource/issues/1106
- fn: vectordatasource.transform.merge_polygon_features
params:
source_layer: earth
- fn: vectordatasource.transform.merge_polygon_features
params:
source_layer: water
# merge line water polygons
- fn: vectordatasource.transform.merge_line_features
params:
source_layer: water
start_zoom: 8
end_zoom: 15
- 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: 16
property_keys: [name, kind]
geometry_types: [Point]
min_distance: 256.0
- fn: vectordatasource.transform.remove_duplicate_features
params:
source_layer: pois
end_zoom: 16
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: 16
- 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