Skip to content

Commit

Permalink
Move leisure=track and attraction=water_slide (#5046)
Browse files Browse the repository at this point in the history
leisure=track and attraction=water_slide moved to layers at more appropriate positions in stack
Minor optimisation of post-road layers
Tweak of SQL ford query
  • Loading branch information
dch0ph authored Jan 16, 2025
1 parent 5791e79 commit adff4bd
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 116 deletions.
190 changes: 108 additions & 82 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,20 @@ Layer:
cache-features: true
group-by: layernotnull
minzoom: 10
- id: leisure-track
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_line
WHERE leisure = 'track'
ORDER BY COALESCE(layer,0)
) AS leisure_track
properties:
minzoom: 16
- id: landuse-overlay
geometry: polygon
<<: *extents
Expand Down Expand Up @@ -812,35 +826,6 @@ Layer:
table: *turning-circle_sql
properties:
minzoom: 15
- id: aerialways
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
aerialway,
man_made,
tags->'substance' AS substance
FROM planet_osm_line
WHERE aerialway IS NOT NULL
OR (man_made = 'pipeline'
AND tags-> 'location' IN ('overground', 'overhead', 'surface', 'outdoor')
OR bridge IN ('yes', 'aqueduct', 'cantilever', 'covered', 'trestle', 'viaduct'))
OR (man_made = 'goods_conveyor'
AND (tags->'location' NOT IN ('underground') OR (tags->'location') IS NULL)
AND (tunnel NOT IN ('yes') OR tunnel IS NULL))
ORDER BY
CASE
WHEN man_made IN ('goods_conveyor', 'pipeline') THEN 1
WHEN tags-> 'location' = 'overhead' THEN 2
WHEN bridge IS NOT NULL THEN 3
WHEN aerialway IS NOT NULL THEN 4
END
) AS aerialways
properties:
minzoom: 12
- id: roads-low-zoom
geometry: linestring
<<: *extents
Expand Down Expand Up @@ -873,29 +858,19 @@ Layer:
cache-features: true
minzoom: 6
maxzoom: 9
- id: waterway-bridges
- id: guideways
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
waterway,
CASE WHEN tags->'intermittent' IN ('yes')
OR tags->'seasonal' IN ('yes', 'spring', 'summer', 'autumn', 'winter', 'wet_season', 'dry_season')
THEN 'yes' ELSE 'no' END AS int_intermittent,
CASE WHEN tunnel IN ('yes', 'culvert')
OR waterway = 'canal' AND tunnel = 'flooded'
THEN 'yes' ELSE 'no' END AS int_tunnel,
'yes' AS bridge
way
FROM planet_osm_line
WHERE waterway IN ('river', 'canal', 'stream', 'drain', 'ditch')
AND bridge IN ('yes', 'aqueduct')
ORDER BY COALESCE(layer,0)
) AS waterway_bridges
WHERE highway = 'bus_guideway'
) AS guideways
properties:
minzoom: 12
minzoom: 11
- id: bridges
geometry: linestring
<<: *extents
Expand Down Expand Up @@ -984,19 +959,70 @@ Layer:
cache-features: true
group-by: layernotnull
minzoom: 10
- id: guideways
- id: aeroways
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
way,
aeroway,
bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct') AS bridge,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay', 'ice', 'snow') THEN 'unpaved'
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood', 'unhewn_cobblestone') THEN 'paved'
ELSE NULL
END AS int_surface
FROM planet_osm_line
WHERE highway = 'bus_guideway'
) AS guideways
WHERE aeroway IN ('runway', 'taxiway')
ORDER BY
bridge NULLS FIRST,
CASE WHEN aeroway = 'runway' THEN 1 ELSE 0 END,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay', 'ice', 'snow') THEN 0 ELSE 1 END
) AS aeroways
properties:
cache-features: true
minzoom: 11
- id: waterway-bridges
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
waterway,
CASE WHEN tags->'intermittent' IN ('yes')
OR tags->'seasonal' IN ('yes', 'spring', 'summer', 'autumn', 'winter', 'wet_season', 'dry_season')
THEN 'yes' ELSE 'no' END AS int_intermittent,
CASE WHEN tunnel IN ('yes', 'culvert')
OR waterway = 'canal' AND tunnel = 'flooded'
THEN 'yes' ELSE 'no' END AS int_tunnel,
'yes' AS bridge
FROM planet_osm_line
WHERE waterway IN ('river', 'canal', 'stream', 'drain', 'ditch')
AND bridge IN ('yes', 'aqueduct')
ORDER BY COALESCE(layer,0)
) AS waterway_bridges
properties:
minzoom: 12
- id: waterslide
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_line
WHERE tags @> 'attraction=>water_slide'
ORDER BY COALESCE(layer,0)
) AS waterslide
properties:
minzoom: 16
- id: roller-coaster-gap-fill
geometry: linestring
<<: *extents
Expand Down Expand Up @@ -1031,6 +1057,35 @@ Layer:
properties:
group-by: layernotnull
minzoom: 15
- id: aerialways
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
aerialway,
man_made,
tags->'substance' AS substance
FROM planet_osm_line
WHERE aerialway IS NOT NULL
OR (man_made = 'pipeline'
AND tags-> 'location' IN ('overground', 'overhead', 'surface', 'outdoor')
OR bridge IN ('yes', 'aqueduct', 'cantilever', 'covered', 'trestle', 'viaduct'))
OR (man_made = 'goods_conveyor'
AND (tags->'location' NOT IN ('underground') OR (tags->'location') IS NULL)
AND (tunnel NOT IN ('yes') OR tunnel IS NULL))
ORDER BY
CASE
WHEN man_made IN ('goods_conveyor', 'pipeline') THEN 1
WHEN tags-> 'location' = 'overhead' THEN 2
WHEN bridge IS NOT NULL THEN 3
WHEN aerialway IS NOT NULL THEN 4
END
) AS aerialways
properties:
minzoom: 12
- id: entrances
geometry: point
<<: *extents
Expand All @@ -1048,33 +1103,6 @@ Layer:
AS entrances
properties:
minzoom: 18
- id: aeroways
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
aeroway,
bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct') AS bridge,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay', 'ice', 'snow') THEN 'unpaved'
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood', 'unhewn_cobblestone') THEN 'paved'
ELSE NULL
END AS int_surface
FROM planet_osm_line
WHERE aeroway IN ('runway', 'taxiway')
ORDER BY
bridge NULLS FIRST,
CASE WHEN aeroway = 'runway' THEN 1 ELSE 0 END,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay', 'ice', 'snow') THEN 0 ELSE 1 END
) AS aeroways
properties:
cache-features: true
minzoom: 11
- id: golf-line
geometry: linestring
<<: *extents
Expand Down Expand Up @@ -1595,7 +1623,7 @@ Layer:
THEN historic END,
'military_'|| CASE WHEN military IN ('danger_area', 'bunker') THEN military END,
'highway_' || CASE WHEN highway IN ('services', 'rest_area', 'bus_stop', 'elevator', 'traffic_signals') THEN highway END,
'highway_'|| CASE WHEN tags @> 'ford=>yes' OR tags @> 'ford=>stepping_stones' AND way_area IS NULL THEN 'ford' END,
'highway_'|| CASE WHEN tags->'ford' IN ('yes', 'stepping_stones') AND way_area IS NULL THEN 'ford' END,
'boundary_' || CASE WHEN boundary IN ('aboriginal_lands', 'national_park')
OR (boundary = 'protected_area' AND tags->'protect_class' IN ('1','1a','1b','2','3','4','5','6'))
THEN boundary END,
Expand Down Expand Up @@ -1748,15 +1776,13 @@ Layer:
(SELECT
way,
COALESCE(
'highway_' || CASE WHEN tags @> 'ford=>yes' OR tags @> 'ford=>stepping_stones' THEN 'ford' END,
'leisure_' || CASE WHEN leisure IN ('slipway', 'track') THEN leisure END,
'attraction_' || CASE WHEN tags @> 'attraction=>water_slide' THEN 'water_slide' END
'highway_' || CASE WHEN tags->'ford' IN ('yes', 'stepping_stones') THEN 'ford' END,
'leisure_' || CASE WHEN leisure = 'slipway' THEN leisure END
) AS feature
FROM planet_osm_line
-- The upcoming where clause is needed for performance only, as the CASE statements would end up doing the equivalent filtering
WHERE tags @> 'ford=>yes' OR tags @> 'ford=>stepping_stones'
OR leisure IN ('slipway', 'track')
OR tags @> 'attraction=>water_slide'
WHERE tags->'ford' IN ('yes', 'stepping_stones')
OR leisure = 'slipway'
ORDER BY COALESCE(layer,0)
) AS amenity_line
properties:
Expand Down
64 changes: 30 additions & 34 deletions style/amenity-points.mss
Original file line number Diff line number Diff line change
Expand Up @@ -3013,42 +3013,38 @@
marker-file: url('symbols/leisure/slipway.svg');
marker-fill: @transportation-icon;
}
}

[feature = 'leisure_track'] {
[zoom >= 16] {
[zoom >= 17] {
bridgecasing/line-color: saturate(darken(@pitch, 30%), 20%);
bridgecasing/line-join: round;
bridgecasing/line-width: 1.25;
[zoom >= 18] { bridgecasing/line-width: 2.5; }
[zoom >= 19] { bridgecasing/line-width: 5; }
}
line-color: @pitch;
line-join: round;
line-cap: round;
line-width: 1;
[zoom >= 18] { line-width: 2; }
[zoom >= 19] { line-width: 4; }
}
}
#leisure-track {
[zoom >= 17] {
bridgecasing/line-color: saturate(darken(@pitch, 30%), 20%);
bridgecasing/line-join: round;
bridgecasing/line-width: 1.25;
[zoom >= 18] { bridgecasing/line-width: 2.5; }
[zoom >= 19] { bridgecasing/line-width: 5; }
}
line-color: @pitch;
line-join: round;
line-cap: round;
line-width: 1;
[zoom >= 18] { line-width: 2; }
[zoom >= 19] { line-width: 4; }
}

[feature = 'attraction_water_slide'] {
[zoom >= 16] {
[zoom >= 17] {
bridgecasing/line-color: black;
bridgecasing/line-join: round;
bridgecasing/line-width: 1.25;
[zoom >= 18] { bridgecasing/line-width: 2.5; }
[zoom >= 19] { bridgecasing/line-width: 5; }
}
line-color: @pitch;
line-join: round;
line-cap: round;
line-width: 1;
[zoom >= 18] { line-width: 2; }
[zoom >= 19] { line-width: 4; }
}
}
#waterslide {
[zoom >= 17] {
bridgecasing/line-color: black;
bridgecasing/line-join: round;
bridgecasing/line-width: 1.25;
[zoom >= 18] { bridgecasing/line-width: 2.5; }
[zoom >= 19] { bridgecasing/line-width: 5; }
}
line-color: @pitch;
line-join: round;
line-cap: round;
line-width: 1;
[zoom >= 18] { line-width: 2; }
[zoom >= 19] { line-width: 4; }
}

#text-line {
Expand Down

0 comments on commit adff4bd

Please sign in to comment.