forked from dooman87/openstreetmap-carto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.yaml
2486 lines (2484 loc) · 107 KB
/
project.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
scale: 1
metatile: 2
name: "OpenStreetMap Carto"
description: "A faithful reimplementation of the standard OpenStreetMap style"
bounds: &world
- -180
- -85.05112877980659
- 180
- 85.05112877980659
center:
- 0
- 0
- 4
format: "png"
interactivity: false
minzoom: 0
maxzoom: 22
srs: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
# Various parts to be included later on
_parts:
# Extents are used for tilemill, and don't actually make it to the generated XML
extents: &extents
extent: *world
srs-name: "900913"
srs: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
extents84: &extents84
extent: *world
srs-name: "WGS84"
srs: "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
osm2pgsql: &osm2pgsql
type: "postgis"
dbname: "gis"
key_field: ""
geometry_field: "way"
extent: "-20037508,-20037508,20037508,20037508"
Stylesheet:
- "style.mss"
- "shapefiles.mss"
- "landcover.mss"
- "water.mss"
- "water-features.mss"
- "roads.mss"
- "power.mss"
- "citywalls.mss"
- "placenames.mss"
- "buildings.mss"
- "stations.mss"
- "amenity-points.mss"
- "ferry-routes.mss"
- "aerialways.mss"
- "admin.mss"
- "addressing.mss"
Layer:
- id: "ocean-lz"
name: "ocean-lz"
class: "ocean"
geometry: "polygon"
<<: *extents
Datasource:
file: "data/simplified-water-polygons-complete-3857/simplified_water_polygons.shp"
type: "shape"
advanced: {}
properties:
maxzoom: 9
- id: "ocean"
name: "ocean"
class: "ocean"
geometry: "polygon"
<<: *extents
Datasource:
file: "data/water-polygons-split-3857/water_polygons.shp"
type: "shape"
properties:
minzoom: 10
advanced: {}
- id: "builtup"
name: "builtup"
geometry: "polygon"
class: ""
extent: *world
srs-name: "mercator"
srs: "+proj=merc +datum=WGS84 +over"
Datasource:
file: "data/world_boundaries/builtup_area.shp"
type: "shape"
properties:
minzoom: 8
maxzoom: 9
advanced: {}
- id: "necountries"
name: "necountries"
class: ""
geometry: "linestring"
<<: *extents84
Datasource:
file: "data/ne_110m_admin_0_boundary_lines_land/ne_110m_admin_0_boundary_lines_land.shp"
type: "shape"
properties:
minzoom: 1
maxzoom: 3
advanced: {}
- id: "landcover-low-zoom"
name: "landcover-low-zoom"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, name, way_pixels,
COALESCE(wetland, landuse, "natural") AS feature
FROM (SELECT
way, COALESCE(name, '') AS name,
('landuse_' || (CASE WHEN landuse IN ('forest', 'military') THEN landuse ELSE NULL END)) AS landuse,
('natural_' || (CASE WHEN "natural" IN ('wood', 'sand', 'scree', 'shingle', 'bare_rock') THEN "natural" ELSE NULL END)) AS "natural",
('wetland_' || (CASE WHEN "natural" IN ('wetland', 'mud') THEN (CASE WHEN "natural" IN ('mud') THEN "natural" ELSE wetland END) ELSE NULL END)) AS wetland,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
FROM planet_osm_polygon
WHERE (landuse IN ('forest', 'military')
OR "natural" IN ('wood', 'wetland', 'mud', 'sand', 'scree', 'shingle', 'bare_rock'))
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
AND building IS NULL
ORDER BY CASE WHEN layer~E'^-?\\d+$' AND length(layer)<10 THEN layer::integer ELSE 0 END, way_area DESC
) AS features
) AS landcover_low_zoom
properties:
maxzoom: 9
advanced: {}
- id: "landcover"
name: "landcover"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, name, religion, way_pixels,
COALESCE(aeroway, amenity, wetland, power, landuse, leisure, military, "natural", tourism, highway, railway) AS feature
FROM (SELECT
way, COALESCE(name, '') AS name,
('aeroway_' || (CASE WHEN aeroway IN ('apron', 'aerodrome') THEN aeroway ELSE NULL END)) AS aeroway,
('amenity_' || (CASE WHEN amenity IN ('parking', 'bicycle_parking', 'motorcycle_parking', 'university', 'college', 'school',
'hospital', 'kindergarten', 'grave_yard', 'prison', 'place_of_worship', 'clinic')
THEN amenity ELSE NULL END)) AS amenity,
('landuse_' || (CASE WHEN landuse IN ('quarry', 'vineyard', 'orchard', 'cemetery', 'residential', 'garages', 'meadow', 'grass',
'allotments', 'forest', 'farmyard', 'farm', 'farmland', 'greenhouse_horticulture',
'recreation_ground', 'village_green', 'retail', 'industrial', 'railway', 'commercial',
'brownfield', 'landfill', 'construction') THEN landuse ELSE NULL END)) AS landuse,
('leisure_' || (CASE WHEN leisure IN ('swimming_pool', 'playground', 'park', 'recreation_ground', 'common', 'garden',
'golf_course', 'miniature_golf', 'picnic_table', 'sports_centre', 'stadium', 'pitch',
'track') THEN leisure ELSE NULL END)) AS leisure,
('military_' || (CASE WHEN military IN ('danger_area') THEN military ELSE NULL END)) AS military,
('natural_' || (CASE WHEN "natural" IN ('beach', 'shoal', 'heath', 'grassland', 'wood', 'sand', 'scree', 'shingle', 'bare_rock', 'scrub') THEN "natural" ELSE NULL END)) AS "natural",
('wetland_' || (CASE WHEN "natural" IN ('wetland', 'marsh', 'mud') THEN (CASE WHEN "natural" IN ('marsh', 'mud') THEN "natural" ELSE wetland END) ELSE NULL END)) AS wetland,
('power_' || (CASE WHEN power IN ('station', 'sub_station', 'substation', 'generator') THEN power ELSE NULL END)) AS power,
('tourism_' || (CASE WHEN tourism IN ('attraction', 'camp_site', 'caravan_site', 'picnic_site') THEN tourism ELSE NULL END)) AS tourism,
('highway_' || (CASE WHEN highway IN ('services', 'rest_area') THEN highway ELSE NULL END)) AS highway,
('railway_' || (CASE WHEN railway = 'station' THEN railway ELSE NULL END)) AS railway,
CASE WHEN religion IN ('christian', 'jewish') THEN religion ELSE 'INT-generic'::text END AS religion,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
FROM planet_osm_polygon
WHERE (landuse IS NOT NULL
OR leisure IS NOT NULL
OR aeroway IN ('apron', 'aerodrome')
OR amenity IN ('parking', 'bicycle_parking', 'motorcycle_parking', 'university', 'college', 'school', 'hospital', 'kindergarten',
'grave_yard', 'place_of_worship', 'prison', 'clinic')
OR military IN ('danger_area')
OR "natural" IN ('beach', 'shoal', 'heath', 'mud', 'marsh', 'wetland', 'grassland', 'wood', 'sand', 'scree', 'shingle', 'bare_rock', 'scrub')
OR power IN ('station', 'sub_station', 'substation', 'generator')
OR tourism IN ('attraction', 'camp_site', 'caravan_site', 'picnic_site')
OR highway IN ('services', 'rest_area')
OR railway = 'station')
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
ORDER BY CASE WHEN layer~E'^-?\\d+$' AND length(layer)<10 THEN layer::integer ELSE 0 END, way_area DESC
) AS landcover
) AS features
properties:
minzoom: 10
advanced: {}
- id: "landcover-line"
name: "landcover-line"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_line
WHERE man_made = 'cutline'
) AS landcover_line
advanced: {}
properties:
minzoom: 14
- id: "water-lines-casing"
name: "water-lines-casing"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, waterway, intermittent,
CASE WHEN tunnel IN ('yes', 'culvert') THEN 'yes' ELSE 'no' END AS int_tunnel
FROM planet_osm_line
WHERE waterway IN ('stream', 'drain', 'ditch')
) AS water_lines_casing
properties:
minzoom: 13
advanced: {}
- id: "water-lines-low-zoom"
name: "water-lines-low-zoom"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT way, waterway, intermittent
FROM planet_osm_line
WHERE waterway = 'river'
) AS water_lines_low_zoom
properties:
minzoom: 8
maxzoom: 11
advanced: {}
- id: "icesheet-poly"
name: "icesheet-poly"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
file: "data/antarctica-icesheet-polygons-3857/icesheet_polygons.shp"
type: "shape"
properties:
minzoom: 4
advanced: {}
- id: "water-areas"
name: "water-areas"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
"natural",
waterway,
landuse,
name,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
FROM planet_osm_polygon
WHERE
(waterway IN ('dock', 'riverbank', 'canal')
OR landuse IN ('reservoir', 'basin')
OR "natural" IN ('water', 'glacier'))
AND building IS NULL
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
ORDER BY z_order, way_area DESC
) AS water_areas
properties:
minzoom: 4
advanced: {}
- id: "landcover-area-symbols"
name: "landcover-area-symbols"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, surface,
COALESCE("natural", CASE WHEN landuse = 'forest' THEN 'wood' ELSE NULL END) AS "natural",
CASE WHEN "natural" IN ('marsh', 'mud')
THEN "natural"
ELSE CASE WHEN ("natural" = 'wetland' AND wetland IS NULL)
THEN 'wetland'
ELSE CASE WHEN ("natural" = 'wetland')
THEN wetland
ELSE NULL
END
END
END AS int_wetland
FROM planet_osm_polygon
WHERE ("natural" IN ('marsh', 'mud', 'wetland', 'wood', 'beach', 'shoal', 'reef') OR landuse = 'forest')
AND building IS NULL
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
ORDER BY z_order, way_area DESC
) AS landcover_area_symbols
properties:
minzoom: 10
advanced: {}
- id: "icesheet-outlines"
name: "icesheet-outlines"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
file: "data/antarctica-icesheet-outlines-3857/icesheet_outlines.shp"
type: "shape"
properties:
minzoom: 4
advanced: {}
- id: "water-lines"
name: "water-lines"
class: "water-lines"
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, waterway, name, intermittent,
CASE WHEN tunnel IN ('yes', 'culvert') THEN 'yes' ELSE 'no' END AS int_tunnel,
'no' AS bridge
FROM planet_osm_line
WHERE waterway IN ('river', 'canal', 'derelict_canal', 'stream', 'drain', 'ditch', 'wadi')
AND (bridge IS NULL OR bridge NOT IN ('yes', 'aqueduct'))
ORDER BY z_order
) AS water_lines
properties:
minzoom: 12
advanced: {}
- id: "water-barriers-line"
name: "water-barriers-line"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT way, waterway, name
FROM planet_osm_line
WHERE waterway IN ('dam', 'weir', 'lock_gate')
) AS water_barriers_line
advanced: {}
properties:
minzoom: 13
- id: "water-barriers-poly"
name: "water-barriers-poly"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT way, waterway, name
FROM planet_osm_polygon
WHERE waterway IN ('dam', 'weir', 'lock_gate')
) AS water_barriers_poly
advanced: {}
properties:
minzoom: 13
- id: "marinas-area"
name: "marinas-area"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_polygon
WHERE leisure = 'marina'
) AS marinas_area
properties:
minzoom: 14
advanced: {}
- id: "piers-poly"
name: "piers-poly"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, man_made
FROM planet_osm_polygon
WHERE man_made IN ('pier', 'breakwater', 'groyne')
) AS piers_poly
properties:
minzoom: 12
advanced: {}
- id: "piers-line"
name: "piers-line"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, man_made
FROM planet_osm_line
WHERE man_made IN ('pier', 'breakwater', 'groyne')
) AS piers_line
properties:
minzoom: 12
advanced: {}
- id: "water-barriers-point"
name: "water-barriers-point"
class: ""
geometry: "point"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, waterway
FROM planet_osm_point
WHERE waterway IN ('dam', 'weir', 'lock_gate')
) AS water_barriers_points
properties:
minzoom: 17
advanced: {}
- id: "bridge"
name: "bridge"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,
man_made,
name
FROM planet_osm_polygon
WHERE man_made = 'bridge'
) AS bridge
properties:
minzoom: 12
advanced: {}
- id: "buildings"
name: "buildings"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
building
FROM planet_osm_polygon
WHERE building IS NOT NULL
AND building != 'no'
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
ORDER BY z_order, way_area DESC
) AS buildings
properties:
minzoom: 12
advanced: {}
- id: "buildings-major"
name: "buildings-major"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
building,
amenity,
aeroway
FROM planet_osm_polygon
WHERE building IS NOT NULL
AND building != 'no'
AND (aeroway = 'terminal' OR amenity = 'place_of_worship')
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
ORDER BY z_order, way_area DESC)
AS buildings_major
properties:
minzoom: 12
advanced: {}
- id: "tunnels"
name: "tunnels"
class: "tunnels-fill tunnels-casing access directions"
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
# This query is quite large, having to deal with both roads, railways and
# runways. To allow for ways that are both railways and roads, a UNION
# ALL is present, and to use an ordering different than current osm2pgsql
# an order is generated in SQL.
table: |-
(SELECT way, (CASE WHEN substr(feature, length(feature)-3, 4) = 'link' THEN substr(feature, 0, length(feature)-4) ELSE feature END) AS feature,
horse, foot, bicycle, tracktype, int_surface, access, construction,
service, oneway, link, layernotnull
FROM ( -- subselect that contains both roads and rail/aero
SELECT
way,
('highway_' || highway) AS feature, --only motorway to tertiary links are accepted later on
horse,
foot,
bicycle,
tracktype,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass',
'grass_paver', 'gravel', 'ground', 'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay') THEN 'unpaved' ELSE
CASE WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood') THEN 'paved'
ELSE null END END AS int_surface,
CASE WHEN access IN ('destination') THEN 'destination'::text
WHEN access IN ('no', 'private') THEN 'no'::text
ELSE NULL
END AS access,
construction,
CASE
WHEN service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text
ELSE 'INT-normal'::text
END AS service,
CASE
WHEN oneway IN ('yes', '-1') THEN oneway
WHEN junction IN ('roundabout') AND (oneway IS NULL OR NOT oneway IN ('no', 'reversible')) THEN 'yes'
ELSE NULL
END AS oneway,
CASE
WHEN substr(highway, length(highway)-3, 4) = 'link' THEN 'yes'
ELSE 'no'
END AS link,
CASE WHEN layer~E'^-?\\d+$' AND length(layer)<10 THEN layer::integer ELSE 0 END AS layernotnull
FROM planet_osm_line
WHERE (tunnel = 'yes' OR tunnel = 'building_passage' OR covered = 'yes')
AND highway IS NOT NULL -- end of road select
UNION ALL
SELECT
way,
COALESCE(
('railway_' || (CASE WHEN railway = 'preserved' AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text
WHEN (railway = 'rail' AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard'
WHEN (railway = 'tram' AND service IN ('spur', 'siding', 'yard')) THEN 'tram-service' ELSE railway END)),
('aeroway_' || aeroway)
) AS feature,
horse,
foot,
bicycle,
tracktype,
'null',
CASE
WHEN access IN ('destination') THEN 'destination'::text
WHEN access IN ('no', 'private') THEN 'no'::text
ELSE NULL
END AS access,
construction,
CASE WHEN service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text ELSE 'INT-normal'::text END AS service,
NULL AS oneway,
'no' AS link,
CASE WHEN layer~E'^-?\\d+$' AND length(layer)<10 THEN layer::integer ELSE 0 END AS layernotnull
FROM planet_osm_line
WHERE (tunnel = 'yes' OR tunnel = 'building_passage' OR covered = 'yes')
AND (railway IS NOT NULL OR aeroway IS NOT NULL) -- end of rail/aero select
) AS features
JOIN (VALUES -- this join is also putting a condition on what is selected. features not matching it do not make it into the results.
('railway_rail', 440),
('railway_INT-preserved-ssy', 430),
('railway_INT-spur-siding-yard', 430),
('railway_subway', 420),
('railway_narrow_gauge', 420),
('railway_light_rail', 420),
('railway_preserved', 420),
('railway_funicular', 420),
('railway_monorail', 420),
('railway_miniature', 420),
('railway_turntable', 420),
('railway_tram', 410),
('railway_tram-service', 405),
('railway_disused', 400),
('railway_construction', 400),
('highway_motorway', 380),
('highway_trunk', 370),
('highway_primary', 360),
('highway_secondary', 350),
('highway_tertiary', 340),
('highway_residential', 330),
('highway_unclassified', 330),
('highway_road', 330),
('highway_living_street', 320),
('highway_pedestrian', 310),
('highway_raceway', 300),
('highway_motorway_link', 240),
('highway_trunk_link', 230),
('highway_primary_link', 220),
('highway_secondary_link', 210),
('highway_tertiary_link', 200),
('highway_service', 150),
('highway_track', 110),
('highway_path', 100),
('highway_footway', 100),
('highway_bridleway', 100),
('highway_cycleway', 100),
('highway_steps', 100),
('highway_platform', 90),
('railway_platform', 90),
('aeroway_runway', 60),
('aeroway_taxiway', 50),
('highway_construction', 10)
) AS ordertable (feature, prio)
USING (feature)
ORDER BY
layernotnull,
prio,
CASE WHEN access IN ('no', 'private') THEN 0 WHEN access IN ('destination') THEN 1 ELSE 2 END,
CASE WHEN int_surface IN ('unpaved') THEN 0 ELSE 2 END
) AS tunnels
properties:
group-by: "layernotnull"
minzoom: 9
advanced: {}
- id: "citywalls"
name: "citywalls"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_line
WHERE historic = 'citywalls')
AS citywalls
advanced: {}
properties:
minzoom: 14
- id: "landuse-overlay"
name: "landuse-overlay"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
landuse,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
FROM planet_osm_polygon
WHERE landuse = 'military'
AND building IS NULL
) AS landuse_overlay
properties:
minzoom: 7
advanced: {}
- id: "line-barriers"
name: "line-barriers"
class: "barriers"
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, barrier
FROM planet_osm_line
WHERE barrier IN ('chain', 'city_wall', 'embankment', 'ditch', 'fence', 'guard_rail',
'handrail', 'hedge', 'kerb', 'retaining_wall', 'wall')
AND (waterway IS NULL OR waterway NOT IN ('river', 'canal', 'derelict_canal', 'stream', 'drain', 'ditch', 'wadi'))
) AS line_barriers
properties:
minzoom: 14
advanced: {}
- id: "cliffs"
name: "cliffs"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, "natural", man_made
FROM planet_osm_line
WHERE "natural" = 'cliff' OR man_made = 'embankment'
) AS cliffs
properties:
minzoom: 13
advanced: {}
- id: "area-barriers"
name: "area-barriers"
class: "barriers"
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, barrier
FROM planet_osm_polygon
WHERE barrier IS NOT NULL
) AS area_barriers
properties:
minzoom: 16
advanced: {}
- id: "ferry-routes"
name: "ferry-routes"
class: ""
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_line
WHERE route = 'ferry'
) AS ferry_routes
properties:
minzoom: 7
advanced: {}
- id: "turning-circle-casing"
name: "turning-circle-casing"
class: ""
geometry: "point"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT DISTINCT ON (p.way)
p.way AS way, l.highway AS int_tc_type,
CASE WHEN l.service IN ('parking_aisle', 'drive-through', 'driveway')
THEN 'INT-minor'::text
ELSE 'INT-normal'::text
END AS int_tc_service
FROM planet_osm_point p
JOIN planet_osm_line l ON ST_DWithin(p.way, l.way, 0.1) -- Assumes Mercator
JOIN (VALUES
('tertiary', 1),
('unclassified', 2),
('residential', 3),
('living_street', 4),
('service', 5)
) AS v (highway, prio)
ON v.highway=l.highway
WHERE p.highway = 'turning_circle'
OR p.highway = 'turning_loop'
ORDER BY p.way, v.prio
) AS turning_circle_casing
properties:
minzoom: 15
advanced: {}
- id: "highway-area-casing"
name: "highway-area-casing"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
COALESCE((
'highway_' || (CASE WHEN highway IN ('residential', 'unclassified', 'pedestrian', 'service', 'footway', 'cycleway', 'track', 'path', 'platform') THEN highway ELSE NULL END)),
('railway_' || (CASE WHEN railway IN ('platform') THEN railway ELSE NULL END))
) AS feature
FROM planet_osm_polygon
WHERE highway IN ('residential', 'unclassified', 'pedestrian', 'service', 'footway', 'track', 'path', 'platform')
OR railway IN ('platform')
ORDER BY z_order, way_area DESC
) AS highway_area_casing
properties:
minzoom: 14
advanced: {}
- name: "roads-casing"
id: "roads-casing"
class: "roads-casing"
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT way, (CASE WHEN substr(feature, length(feature)-3, 4) = 'link' THEN substr(feature, 0, length(feature)-4) ELSE feature END) AS feature,
horse, foot, bicycle, tracktype, int_surface, access, construction,
service, oneway, link, layernotnull
FROM ( -- subselect that contains both roads and rail/aero
SELECT
way,
('highway_' || highway) AS feature, --only motorway to tertiary links are accepted later on
horse,
foot,
bicycle,
tracktype,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass',
'grass_paver', 'gravel', 'ground', 'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay') THEN 'unpaved' ELSE
CASE WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood') THEN 'paved'
ELSE null END END AS int_surface,
CASE WHEN access IN ('destination') THEN 'destination'::text
WHEN access IN ('no', 'private') THEN 'no'::text
ELSE NULL
END AS access,
construction,
CASE
WHEN service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text
ELSE 'INT-normal'::text
END AS service,
CASE
WHEN oneway IN ('yes', '-1') THEN oneway
WHEN junction IN ('roundabout') AND (oneway IS NULL OR NOT oneway IN ('no', 'reversible')) THEN 'yes'
ELSE NULL
END AS oneway,
CASE
WHEN substr(highway, length(highway)-3, 4) = 'link' THEN 'yes'
ELSE 'no'
END AS link,
CASE WHEN layer~E'^-?\\d+$' AND length(layer)<10 THEN layer::integer ELSE 0 END AS layernotnull
FROM planet_osm_line
WHERE (tunnel IS NULL OR NOT tunnel IN ('yes', 'building_passage'))
AND (covered IS NULL OR NOT covered = 'yes')
AND (bridge IS NULL OR NOT bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct'))
AND highway IS NOT NULL -- end of road select
UNION ALL
SELECT
way,
COALESCE(
('railway_' || (CASE WHEN railway = 'preserved' AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text
WHEN (railway = 'rail' AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard'
WHEN (railway = 'tram' AND service IN ('spur', 'siding', 'yard')) THEN 'tram-service' ELSE railway END)),
('aeroway_' || aeroway)
) AS feature,
horse,
foot,
bicycle,
tracktype,
'null',
CASE
WHEN access IN ('destination') THEN 'destination'::text
WHEN access IN ('no', 'private') THEN 'no'::text
ELSE NULL
END AS access,
construction,
CASE WHEN service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text ELSE 'INT-normal'::text END AS service,
NULL AS oneway,
'no' AS link,
CASE WHEN layer~E'^-?\\d+$' AND length(layer)<10 THEN layer::integer ELSE 0 END AS layernotnull
FROM planet_osm_line
WHERE (tunnel IS NULL OR NOT tunnel IN ('yes', 'building_passage'))
AND (covered IS NULL OR NOT covered = 'yes')
AND (bridge IS NULL OR NOT bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct'))
AND (railway IS NOT NULL OR aeroway IS NOT NULL) -- end of rail/aero select
) AS features
JOIN (VALUES -- this join is also putting a condition on what is selected. features not matching it do not make it into the results.
('railway_rail', 440),
('railway_INT-preserved-ssy', 430),
('railway_INT-spur-siding-yard', 430),
('railway_subway', 420),
('railway_narrow_gauge', 420),
('railway_light_rail', 420),
('railway_preserved', 420),
('railway_funicular', 420),
('railway_monorail', 420),
('railway_miniature', 420),
('railway_turntable', 420),
('railway_tram', 410),
('railway_tram-service', 405),
('railway_disused', 400),
('railway_construction', 400),
('highway_motorway', 380),
('highway_trunk', 370),
('highway_primary', 360),
('highway_secondary', 350),
('highway_tertiary', 340),
('highway_residential', 330),
('highway_unclassified', 330),
('highway_road', 330),
('highway_living_street', 320),
('highway_pedestrian', 310),
('highway_raceway', 300),
('highway_motorway_link', 240),
('highway_trunk_link', 230),
('highway_primary_link', 220),
('highway_secondary_link', 210),
('highway_tertiary_link', 200),
('highway_service', 150),
('highway_track', 110),
('highway_path', 100),
('highway_footway', 100),
('highway_bridleway', 100),
('highway_cycleway', 100),
('highway_steps', 100),
('highway_platform', 90),
('railway_platform', 90),
('aeroway_runway', 60),
('aeroway_taxiway', 50),
('highway_construction', 10)
) AS ordertable (feature, prio)
USING (feature)
ORDER BY
layernotnull,
prio,
CASE WHEN access IN ('no', 'private') THEN 0 WHEN access IN ('destination') THEN 1 ELSE 2 END,
CASE WHEN int_surface IN ('unpaved') THEN 0 ELSE 2 END
) AS roads_casing
properties:
minzoom: 9
advanced: {}
- id: "highway-area-fill"
name: "highway-area-fill"
class: ""
# FIXME: No geometry?
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
COALESCE(
('highway_' || (CASE WHEN highway IN ('residential', 'unclassified', 'pedestrian', 'service', 'footway', 'cycleway', 'living_street',
'track', 'path', 'platform', 'services') THEN highway ELSE NULL END)),
('railway_' || (CASE WHEN railway IN ('platform') THEN railway ELSE NULL END)),
(('aeroway_' || CASE WHEN aeroway IN ('runway', 'taxiway', 'helipad') THEN aeroway ELSE NULL END))
) AS feature
FROM planet_osm_polygon
WHERE highway IN ('residential', 'unclassified', 'pedestrian', 'service', 'footway', 'living_street', 'track', 'path', 'platform', 'services')
OR railway IN ('platform')
OR aeroway IN ('runway', 'taxiway', 'helipad')
ORDER BY z_order, way_area desc
) AS highway_area_fill
properties:
minzoom: 14
advanced: {}
- id: "roads-fill"
name: "roads-fill"
class: "roads-fill access directions"
geometry: "linestring"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT way, (CASE WHEN substr(feature, length(feature)-3, 4) = 'link' THEN substr(feature, 0, length(feature)-4) ELSE feature END) AS feature,
horse, foot, bicycle, tracktype, int_surface, access, construction,
service, oneway, link, layernotnull
FROM ( -- subselect that contains both roads and rail/aero
SELECT
way,
('highway_' || highway) AS feature, --only motorway to tertiary links are accepted later on
horse,
foot,
bicycle,
tracktype,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay') THEN 'unpaved' ELSE
CASE WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood') THEN 'paved'
ELSE null END END AS int_surface,
CASE WHEN access IN ('destination') THEN 'destination'::text
WHEN access IN ('no', 'private') THEN 'no'::text
ELSE NULL
END AS access,
construction,
CASE
WHEN service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text
ELSE 'INT-normal'::text
END AS service,
CASE
WHEN oneway IN ('yes', '-1') THEN oneway
WHEN junction IN ('roundabout') AND (oneway IS NULL OR NOT oneway IN ('no', 'reversible')) THEN 'yes'
ELSE NULL
END AS oneway,
CASE
WHEN substr(highway, length(highway)-3, 4) = 'link' THEN 'yes'
ELSE 'no'
END AS link,
CASE WHEN layer~E'^-?\\d+$' AND length(layer)<10 THEN layer::integer ELSE 0 END AS layernotnull
FROM planet_osm_line
WHERE (tunnel IS NULL OR NOT tunnel IN ('yes', 'building_passage'))
AND (covered IS NULL OR NOT covered = 'yes')
AND (bridge IS NULL OR NOT bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct'))
AND highway IS NOT NULL -- end of road select
UNION ALL
SELECT
way,
COALESCE(
('railway_' || (CASE WHEN railway = 'preserved' AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text
WHEN (railway = 'rail' AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard'
WHEN (railway = 'tram' AND service IN ('spur', 'siding', 'yard')) THEN 'tram-service' ELSE railway END)),
('aeroway_' || aeroway)
) AS feature,
horse,
foot,
bicycle,
tracktype,
'null',
CASE
WHEN access IN ('destination') THEN 'destination'::text
WHEN access IN ('no', 'private') THEN 'no'::text
ELSE NULL
END AS access,