Skip to content

Commit

Permalink
Copy roads_sql subqueries to bridges.
Browse files Browse the repository at this point in the history
  • Loading branch information
StyXman committed Nov 2, 2024
1 parent f679df9 commit f26736c
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,14 @@ Layer:
<<: *extents
Datasource:
<<: *osm2pgsql
# NOTE: There are 3 similar queries: here and in the roads-casing and bridges layers. Any change introduced
# in this query must be considered for inclusion in the other two. Changes in the WHERE clause should be
# particularly thought through.

# This is one of the most complex layers, so it bears explaining in some detail
# It is necessary to
# - Have roads and railways in the same layer to get ordering right
# - Return two linestrings for ways which are both a road and railway
table: |-
(SELECT
way,
Expand All @@ -921,21 +929,22 @@ Layer:
tracktype,
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',
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood', 'unhewn_cobblestone') THEN 'paved'
END AS int_surface,
carto_highway_int_access(highway, access, foot, bicycle, horse, tags->'motorcar', tags->'motor_vehicle', tags->'vehicle') AS int_access,
construction,
CASE
WHEN service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text
WHEN service IN ('parking_aisle', 'drive-through', 'driveway') OR leisure IN ('slipway') THEN 'INT-minor'::text
ELSE 'INT-normal'::text
END AS service,
CASE
WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') THEN 'yes'
ELSE 'no'
END AS link,
'no' AS preserved,
NULL AS preserved,
COALESCE(layer,0) AS layernotnull,
osm_id,
z_order
FROM planet_osm_line
WHERE bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct')
Expand All @@ -948,16 +957,17 @@ Layer:
WHEN (railway = 'tram' AND service IN ('spur', 'siding', 'yard')) THEN 'tram-service'
ELSE railway END) AS feature,
tracktype,
'null',
NULL,
NULL AS int_surface,
NULL AS access,
construction,
CASE WHEN service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text ELSE 'INT-normal'::text END AS service,
'no' AS link,
(CASE
NULL AS service,
NULL AS link,
CASE
WHEN tags->'railway:preserved' = 'yes' THEN 'yes'
ELSE 'no'
END) AS preserved,
END AS preserved,
COALESCE(layer,0) AS layernotnull,
osm_id,
z_order
FROM planet_osm_line
WHERE bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct')
Expand Down

0 comments on commit f26736c

Please sign in to comment.