-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathosm_eu.yml
680 lines (621 loc) · 19.3 KB
/
osm_eu.yml
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
name: OpenStreetMap euskara da
description: 'A general-purpose OpenStreetMap mapnik style, focused on minored langages, in CartoCSS'
attribution: 'CC-BY-SA OSM-BZH'
scale: 1
metatile: 2
bounds: &world
- -180
- -85
- 180
- 85
center:
- -2.96
- 48.03
- 8
format: 'png'
interactivity: false
minzoom: 4
maxzoom: 18
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"
_parts:
# default values used by layers
extents: &extents
extent: *world
srs-name: "3857"
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"
class: ''
status: 'on'
extents84: &extents84
extent: *world
srs-name: "WGS84"
srs: "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
osm2pgsql: &osm2pgsql
type: "postgis"
dbname: "osm"
key_field: ""
geometry_field: "way"
extent: "-20037508,-20037508,20037508,20037508"
host: db.openstreetmap.world
user: osmbr
password: m4d31nbr31zh
asynchronous_request: true
max_async_connection: 4
max_size: 50
cursor_size: 5000
# stylesheets
Stylesheet:
- styles/palette.mss
- styles/base.mss
- styles/landcover.mss
- styles/admin.mss
- styles/roads.mss
- styles/placenames.mss
- styles/labels.mss
# the layers
Layer:
- id: land_low
geometry: polygon
<<: *extents
Datasource:
file: /data/project/styles/data/simplified-land-polygons-complete-3857/simplified_land_polygons.shp
type: shape
properties:
maxzoom: 10
- id: land_high
geometry: polygon
<<: *extents
Datasource:
file: /data/project/styles/data/land-polygons-split-3857/land_polygons.shp
type: shape
- id: landcover_low
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, way, way_area AS area, COALESCE(landuse, leisure, "natural", highway, amenity, tourism) AS type
FROM
planet_osm_polygon
WHERE
landuse IN ('forest')
AND way && !bbox!
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
) AS landcover_low
simplify_geometries: 'true'
properties:
minzoom: 6
maxzoom: 9
- id: landcover
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, way, way_area AS area, COALESCE(landuse, leisure, "natural", highway, amenity, tourism) AS type
FROM
planet_osm_polygon
WHERE
way && !bbox!
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
ORDER BY z_order, way_area DESC
) AS landcover
simplify_geometries: 'true'
properties:
minzoom: 10
- id: aeroway
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, way, aeroway AS type
FROM
planet_osm_line
WHERE
aeroway IN ('apron', 'runway', 'taxiway')
) AS aeroway
properties:
minzoom: 10
- id: waterarea_low
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, way, "natural" AS type, way_area AS area
FROM
planet_osm_polygon
WHERE
("natural" IN ('water', 'pond')
OR waterway IN ('basin', 'canal', 'mill_pond', 'pond', 'riverbank', 'stream'))
AND way_area > 75000
) AS waterarea_low
simplify_geometries: 'true'
properties:
minzoom: 7
maxzoom: 10
- id: waterarea_med
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, way, "natural" AS type, way_area AS area
FROM
planet_osm_polygon
WHERE
("natural" IN ('water', 'pond')
OR waterway IN ('basin', 'canal', 'mill_pond', 'pond', 'riverbank', 'stream'))
AND way_area > 50000
) AS waterarea_med
simplify_geometries: 'true'
properties:
minzoom: 10
maxzoom: 12
- id: waterarea
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
way,
way_area AS area,
COALESCE(tags -> 'name:eu'::text) as name,
COALESCE(waterway, '') || COALESCE(landuse, '') || COALESCE("natural", '') as type
FROM
planet_osm_polygon
WHERE
waterway IN ('riverbank')
OR (landuse = ANY (ARRAY['reservoir'::text, 'water'::text, 'basin'::text, 'salt_pond'::text]))
OR ("natural" = ANY (ARRAY['lake'::text, 'water'::text])) OR amenity = 'swimming_pool'::text
OR leisure = 'swimming_pool'::text
) AS waterarea
properties:
minzoom: 12
- id: waterway_low
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, COALESCE(tags -> 'name:eu'::text) as name, COALESCE(waterway, '') as type, way
FROM
planet_osm_line
WHERE
waterway in ('river','canal')
ORDER BY z_order
) AS waterway_low
simplify_geometries: 'true'
properties:
minzoom: 8
maxzoom: 12
- id: waterway_med
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, COALESCE(tags -> 'name:eu'::text) as name, COALESCE(waterway, '') as type, way
FROM
planet_osm_line
WHERE
waterway in ('stream','river','canal')
ORDER BY z_order
) AS waterway_med
simplify_geometries: 'true'
properties:
minzoom: 13
maxzoom: 14
- id: waterway_high
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, COALESCE(tags -> 'name:eu'::text) as name, COALESCE(waterway, '') as type, way
FROM
planet_osm_line
WHERE
waterway in ('weir','river','canal','derelict_canal','stream','drain','ditch','wadi')
ORDER BY z_order
) AS waterway_high
properties:
minzoom: 15
- id: buildings
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id, way, 'building' AS type
FROM
planet_osm_polygon
WHERE
building NOT IN ('', '0','false', 'no')
ORDER BY z_order, way_area DESC
) AS buildings
properties:
minzoom: 13
- id: rail_low
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
way,
COALESCE(railway) AS type,
tags->'usage'::text AS usage,
tunnel,
bridge
FROM
planet_osm_line
WHERE
railway IN ('rail') AND tags->'usage'::text IN ('main', 'branch')
) AS rail_low
simplify_geometries: 'true'
properties:
minzoom: 6
maxzoom: 8
- id: tunnel
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
way,
COALESCE(highway, railway) AS type,
0 AS bridge,
access,
render,
layer,
1 as tunnel,
CASE
WHEN highway IN ('motorway', 'trunk') THEN 'motorway'
WHEN highway IN ('primary', 'secondary') THEN 'mainroad'
WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclassified', 'road', 'living_street') THEN 'minorroad'
WHEN highway IN ('service', 'track') THEN 'service'
WHEN highway IN ('path', 'cycleway', 'footway', 'pedestrian', 'steps', 'bridleway') THEN 'noauto'
WHEN railway IN ('light_rail', 'subway', 'narrow_gauge', 'rail', 'tram') THEN 'railway'
ELSE
'other'
END AS stylegroup
FROM
(
SELECT *, '1_outline' AS render
FROM planet_osm_line
WHERE tunnel NOT IN ('', '0', 'no')
UNION ALL
SELECT *, '2_line' AS render
FROM planet_osm_line
WHERE tunnel NOT IN ('', '0', 'no')
UNION ALL
SELECT *, '3_inline' AS render
FROM planet_osm_line
WHERE tunnel NOT IN ('', '0', 'no')
) AS tunnels
ORDER BY layer ASC, render ASC ) AS tunnel
simplify_geometries: 'true'
properties:
minzoom: 11
- id: roads_low
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
way,
COALESCE(highway, railway) AS type,
0 AS tunnel,
0 AS bridge,
access,
'fill' AS render,
CASE
WHEN highway IN ('motorway', 'trunk') THEN 'motorway'
WHEN highway IN ('primary') THEN 'mainroad'
WHEN railway IN ('rail') THEN 'railway'
ELSE 'other'
END AS stylegroup
FROM planet_osm_line
WHERE
highway IN ('motorway', 'trunk', 'primary')
OR railway IN ('rail')
AND (tunnel IS NULL OR tunnel = 'no')
AND (bridge IS NULL OR bridge = 'no')
ORDER BY z_order ) AS roads_low
simplify_geometries: 'true'
properties:
minzoom: 6
maxzoom: 8
- id: roads_med
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
way,
COALESCE(highway, railway) AS type,
0 AS tunnel, 0 AS bridge, access, 'fill' AS render,
CASE
WHEN highway IN ('motorway', 'trunk') THEN 'motorway'
WHEN highway IN ('primary', 'secondary') THEN 'mainroad'
WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'minorroad'
WHEN railway IN ('light_rail', 'subway', 'narrow_gauge', 'rail', 'tram') THEN 'railway'
ELSE 'other'
END AS stylegroup
FROM planet_osm_line
WHERE
highway IN ('motorway', 'trunk', 'primary', 'secondary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary', 'tertiary_link')
OR railway IN ('light_rail', 'subway', 'narrow_gauge', 'rail', 'tram')
AND (tunnel IS NULL OR tunnel = 'no') AND (bridge IS NULL OR bridge = 'no')
ORDER BY z_order ) AS roads_med
simplify_geometries: 'true'
properties:
minzoom: 9
maxzoom: 10
- id: roads_high
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
way,
COALESCE(highway, railway) AS type,
0 AS tunnel,
0 AS bridge,
access,
'fill' AS render,
CASE
WHEN highway IN ('motorway', 'trunk') THEN 'motorway'
WHEN highway IN ('primary', 'secondary') THEN 'mainroad'
WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclassified', 'road', 'living_street') THEN 'minorroad'
WHEN highway IN ('service', 'track') THEN 'service'
WHEN highway IN ('path', 'cycleway', 'footway', 'pedestrian', 'steps', 'bridleway') THEN 'noauto'
WHEN railway IN ('light_rail', 'subway', 'narrow_gauge', 'rail', 'tram') THEN 'railway'
ELSE 'other'
END AS stylegroup
FROM planet_osm_line
WHERE
(highway IS NOT NULL OR railway IS NOT NULL)
AND (tunnel IS NULL OR tunnel = 'no')
AND (bridge IS NULL OR bridge = 'no')
ORDER BY z_order ) AS roads_high
simplify_geometries: 'true'
properties:
minzoom: 11
- id: bridge
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
COALESCE(highway, railway) AS type,
1 AS bridge, access, render, layer,
0 as tunnel,
CASE
WHEN highway IN ('motorway', 'trunk') THEN 'motorway'
WHEN highway IN ('primary', 'secondary') THEN 'mainroad'
WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclassified', 'road', 'living_street') THEN 'minorroad'
WHEN highway IN ('service', 'track') THEN 'service'
WHEN highway IN ('path', 'cycleway', 'footway', 'pedestrian', 'steps', 'bridleway') THEN 'noauto'
WHEN railway IN ('light_rail', 'subway', 'narrow_gauge', 'rail', 'tram') THEN 'railway'
ELSE 'other'
END AS stylegroup
FROM
(
SELECT *, '1_outline' AS render
FROM planet_osm_line
WHERE bridge NOT IN ('', '0', 'no')
UNION ALL
SELECT *, '2_line' AS render
FROM planet_osm_line
WHERE bridge NOT IN ('', '0', 'no')
UNION ALL
SELECT *, '3_inline' AS render
FROM planet_osm_line
WHERE bridge NOT IN ('', '0', 'no')
) AS bridges
ORDER BY layer ASC, render ASC ) AS bridge
simplify_geometries: 'true'
properties:
minzoom: 11
- id: admin_boundaries
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
ST_Simplify(b.way,!pixel_width!/4) as way,
admin_level::integer AS admin_level,
coalesce(b.tags->'maritime','no') AS maritime,
count(r.*)::integer AS nb,
string_agg(id::text,',') AS rels
FROM planet_osm_roads b
LEFT JOIN planet_osm_rels r ON (r.parts @> ARRAY[osm_id]
AND r.members @> ARRAY['w' || osm_id]
AND regexp_replace(r.tags::text,'[{}]',',') ~ format('(,admin_level,%s.*,boundary,administrative|,boundary,administrative.*,admin_level,%s,)',admin_level,admin_level))
WHERE
way && !bbox!
AND boundary='administrative'
AND admin_level IS NOT NULL
GROUP BY 1,2,3
ORDER BY admin_level DESC ) AS admin_boundaries
simplify_geometries: 'true'
properties:
minzoom: 11
- id: placenames_medium
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT name, place, admin_level, way
FROM
(
SELECT
ROW_NUMBER() OVER(PARTITION BY p.osm_id
ORDER BY substring(substring(r.tags::text,'admin_level,[0-9]'),'[0-9]') ASC) AS rank
, p.osm_id
, p.place
, COALESCE(p.tags -> 'name:eu'::text,'') as name
, substring(substring(r.tags::text,'admin_level,[0-9]'),'[0-9]')::integer AS admin_level
, p.way
FROM planet_osm_point p
LEFT JOIN planet_osm_rels r ON (r.parts @> ARRAY[p.osm_id] AND r.members @> ARRAY['n' || p.osm_id])
WHERE
way && !bbox!
AND p.place IN ('town','city')
AND r.members::text ~ 'admin_centre'
AND r.tags::text ~ 'admin_level,[0-9]' = TRUE
GROUP BY osm_id, place, COALESCE(p.tags -> 'name:eu'::text,''), way, substring(substring(r.tags::text,'admin_level,[0-9]'),'[0-9]')
) AS src
WHERE rank = 1 AND name <> ''
ORDER BY admin_level, name ) AS placenames_medium
properties:
cache-features: true
minzoom: 4
maxzoom: 15
- id: placenames_small
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
place,
COALESCE(tags -> 'name:eu'::text,'') as name
FROM planet_osm_point
WHERE
place IN ('suburb','village','locality','hamlet','quarter','neighbourhood','isolated_dwelling','farm')
AND COALESCE(tags -> 'name:eu'::text) IS NOT NULL
AND NOT tags @> 'capital=>yes'
ORDER BY CASE
WHEN place = 'suburb' THEN 7
WHEN place = 'village' THEN 6
WHEN place IN ('locality','hamlet') THEN 5
WHEN place = 'quarter' THEN 4
WHEN place = 'neighbourhood' THEN 3
WHEN place = 'isolated_dwelling' THEN 2
WHEN place = 'farm' THEN 1
END DESC) AS placenames_small
properties:
cache-features: true
minzoom: 10
maxzoom: 17
- id: motorway_label
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
COALESCE(highway, '') as type,
COALESCE(tags -> 'name:eu'::text,'') as name,
ref,
oneway,
CHAR_LENGTH(ref) AS reflen,
way
FROM
planet_osm_line
WHERE
highway IN ('motorway', 'trunk')
AND (COALESCE(tags -> 'name:eu'::text,'') IS NOT NULL OR ref IS NOT NULL) ) AS motorway_label
simplify_geometries: 'true'
properties:
minzoom: 9
- id: mainroad_label
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
COALESCE(highway, '') as type,
COALESCE(tags -> 'name:eu'::text,'') as name,
way
FROM
planet_osm_line
WHERE
highway IN ('primary', 'secondary', 'tertiary') ) AS mainroad_label
simplify_geometries: 'true'
properties:
minzoom: 12
- id: minorroad_label
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
osm_id,
COALESCE(highway, '') as type,
COALESCE(tags -> 'name:eu'::text,'') as name,
way
FROM
planet_osm_line
WHERE
highway IN ('motorway','motorway_link','trunk','trunk_link','primary','primary_link','secondary','secondary_link','tertiary','tertiary_link','road','path','track','service','footway','bridleway','cycleway','steps','pedestrian','living_street','unclassified','residential','raceway') ) AS minorroad_label
simplify_geometries: 'true'
properties:
minzoom: 14
- id: building_label
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
COALESCE(tags -> 'name:eu'::text) as name,
way,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
FROM planet_osm_polygon
WHERE building IS NOT NULL
AND building NOT IN ('no')
AND name IS NOT NULL
ORDER BY way_area DESC
) AS building_text
properties:
minzoom: 14
- id: leisure_label
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
COALESCE(tags -> 'name:eu'::text) as name,
way,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
FROM planet_osm_polygon
WHERE leisure IN ('park', 'sports_centre', 'stadium', 'pitch')
AND name IS NOT NULL
ORDER BY way_area DESC
) AS leisure_text
properties:
minzoom: 14