diff --git a/project.mml b/project.mml index 8152046e5..b18e39b7c 100644 --- a/project.mml +++ b/project.mml @@ -453,6 +453,7 @@ Layer: construction, service, link, + preserved, layernotnull FROM ( -- subselect that contains both roads and rail SELECT @@ -479,6 +480,7 @@ Layer: WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') THEN 'yes' ELSE 'no' END AS link, + 'no' as preserved, COALESCE(layer,0) AS layernotnull, z_order FROM planet_osm_line @@ -487,7 +489,7 @@ Layer: UNION ALL SELECT way, - 'railway_' || (CASE WHEN railway = 'preserved' AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + 'railway_' || (CASE 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) AS feature, @@ -503,6 +505,10 @@ Layer: 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 + WHEN tags->'railway:preserved' = 'yes' THEN 'yes' + ELSE 'no' + END) AS preserved, COALESCE(layer,0) AS layernotnull, z_order FROM planet_osm_line @@ -513,7 +519,7 @@ Layer: layernotnull, z_order, CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END, - CASE WHEN feature IN ('railway_INT-preserved-ssy', 'railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END, + CASE WHEN feature IN ('railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END, 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 1 END ) AS tunnels @@ -690,6 +696,7 @@ Layer: construction, service, link, + preserved, layernotnull FROM ( -- subselect that contains both roads and rail/aero SELECT @@ -716,6 +723,7 @@ Layer: WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') THEN 'yes' ELSE 'no' END AS link, + 'no' AS preserved, COALESCE(layer,0) AS layernotnull, osm_id, z_order @@ -727,10 +735,10 @@ Layer: UNION ALL SELECT way, - ('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)) AS feature, + 'railway_' || (CASE + 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) AS feature, horse, foot, bicycle, @@ -748,6 +756,10 @@ Layer: construction, CASE WHEN service IN ('parking_aisle', 'drive-through', 'driveway') OR leisure IN ('slipway') THEN 'INT-minor'::text ELSE 'INT-normal'::text END AS service, 'no' AS link, + (CASE + WHEN tags->'railway:preserved' = 'yes' THEN 'yes' + ELSE 'no' + END) AS preserved, COALESCE(layer,0) AS layernotnull, osm_id, z_order @@ -762,7 +774,7 @@ Layer: layernotnull, z_order, CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END, - CASE WHEN feature IN ('railway_INT-preserved-ssy', 'railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END, + CASE WHEN feature IN ('railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END, 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 1 END, osm_id @@ -860,8 +872,7 @@ Layer: COALESCE( ('highway_' || (CASE WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') THEN substr(highway, 0, length(highway)-4) ELSE highway end)), - ('railway_' || (CASE WHEN (railway = 'rail' AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' - WHEN railway IN ('rail', 'tram', 'light_rail', 'funicular', 'narrow_gauge') THEN railway END)) + ('railway_' || railway) ) AS feature, CASE WHEN tunnel = 'yes' OR tunnel = 'building_passage' OR covered = 'yes' THEN 'yes' ELSE 'no' END AS int_tunnel, CASE WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') THEN 'yes' ELSE 'no' END AS link, @@ -872,7 +883,8 @@ Layer: END AS int_surface FROM planet_osm_roads WHERE highway IS NOT NULL - OR (railway IS NOT NULL AND railway != 'preserved' + OR (railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge') + AND (tags->'railway:preserved' IS NULL OR tags->'railway:preserved' != 'yes') AND (service IS NULL OR service NOT IN ('spur', 'siding', 'yard'))) ORDER BY z_order @@ -922,6 +934,7 @@ Layer: construction, service, link, + preserved, layernotnull FROM ( -- subselect that contains both roads and rail/aero SELECT @@ -948,6 +961,7 @@ Layer: WHEN highway IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') THEN 'yes' ELSE 'no' END AS link, + 'no' AS preserved, COALESCE(layer,0) AS layernotnull, z_order FROM planet_osm_line @@ -956,7 +970,7 @@ Layer: UNION ALL SELECT way, - 'railway_' || (CASE WHEN railway = 'preserved' AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + 'railway_' || (CASE 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) AS feature, @@ -972,6 +986,10 @@ Layer: 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 + WHEN tags->'railway:preserved' = 'yes' THEN 'yes' + ELSE 'no' + END) AS preserved, COALESCE(layer,0) AS layernotnull, z_order FROM planet_osm_line @@ -982,7 +1000,7 @@ Layer: layernotnull, z_order, CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END, - CASE WHEN feature IN ('railway_INT-preserved-ssy', 'railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END, + CASE WHEN feature IN ('railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END, 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 1 END ) AS bridges @@ -1975,17 +1993,22 @@ Layer: table: |- (SELECT way, - 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 AS railway, + CASE + 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 AS railway, CASE WHEN (tunnel = 'yes' OR tunnel = 'building_passage' OR covered = 'yes') THEN 'yes' ELSE 'no' END AS tunnel, tags->'highspeed' as highspeed, tags->'usage' as usage, construction, - name + name, + (CASE + WHEN tags->'railway:preserved' = 'yes' THEN 'yes' + ELSE 'no' + END) AS preserved FROM planet_osm_line l - WHERE railway IN ('rail', 'subway', 'narrow_gauge', 'light_rail', 'preserved', 'funicular', - 'monorail', 'miniature', 'tram', 'disused', 'construction') + WHERE railway IN ('rail', 'subway', 'narrow_gauge', 'light_rail', 'funicular', 'monorail', 'miniature', 'tram', 'disused', 'construction') AND (tunnel IS NULL OR NOT tunnel IN ('yes', 'building_passage')) AND highway IS NULL -- Prevent duplicate rendering AND name IS NOT NULL diff --git a/style/roads.mss b/style/roads.mss index e6d9d338f..a1ba5f44f 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -830,7 +830,6 @@ } [feature = 'railway_rail'], - [feature = 'railway_preserved'], [feature = 'railway_monorail'][zoom >= 14] { #bridges { [zoom >= 13] { @@ -853,8 +852,7 @@ [feature = 'railway_disused'][zoom >= 15], [feature = 'railway_construction'][construction != 'subway'], - [feature = 'railway_miniature'][zoom >= 15], - [feature = 'railway_INT-preserved-ssy'][zoom >= 14] { + [feature = 'railway_miniature'][zoom >= 15] { #bridges { [zoom >= 13] { line-width: 6; @@ -1025,7 +1023,6 @@ } [feature = 'railway_rail'][zoom >= 13], - [feature = 'railway_preserved'][zoom >= 13], [feature = 'railway_monorail'][zoom >= 14] { #bridges { line-width: 5; @@ -1046,8 +1043,7 @@ [feature = 'railway_disused'][zoom >= 15], [feature = 'railway_construction'][construction != 'subway'], - [feature = 'railway_miniature'][zoom >= 15], - [feature = 'railway_INT-preserved-ssy'][zoom >= 14] { + [feature = 'railway_miniature'][zoom >= 15] { #bridges { [zoom >= 13] { line-width: 4.5; @@ -2527,7 +2523,9 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ } } - [feature = 'railway_rail'][zoom >= 8], + [feature = 'railway_rail'][zoom >= 8][zoom < 10], + [feature = 'railway_rail'][preserved != 'yes'][zoom >= 10][zoom < 12], + [feature = 'railway_rail'][zoom >= 12], [feature = 'railway_INT-spur-siding-yard'][zoom >= 13] { [zoom < 13] { line-color: #787878; @@ -2553,7 +2551,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ dark/line-width: 3; light/line-width: 1; } - [zoom >= 15] { + [zoom >= 15][preserved != 'yes'] { light/line-dasharray: 0,8,8,1; } [zoom >= 18] { @@ -2571,6 +2569,13 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ light/line-width: 1; } } + [preserved = 'yes'] { + dark/line-width: 3; + dark/line-color: #666; + light/line-width: 1; + light/line-color: white; + light/line-dasharray: 0,1,8,1; + } } #tunnels { line-color: #787878; @@ -2582,7 +2587,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 1.9; line-dasharray: 3,3; [zoom >= 18] { - line-width: 2.7; + line-width: 2.7; } } [feature = 'railway_rail'][zoom >= 18] { @@ -2596,12 +2601,24 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [feature = 'railway_light_rail'], [feature = 'railway_funicular'], [feature = 'railway_narrow_gauge'] { - [zoom >= 8] { + [zoom >= 8][zoom < 10], + [preserved != 'yes'][zoom >= 10][zoom < 12], + [zoom >= 12] { line-color: #ccc; [zoom >= 10] { line-color: #aaa; } [zoom >= 13] { line-color: #666; } line-width: 1; [zoom >= 13] { line-width: 2; } + [preserved = 'yes'][zoom >= 13] { + #roads-fill, #bridges { + dark/line-width: 3; + dark/line-color: #999; + light/line-width: 1; + light/line-color: white; + light/line-dasharray: 0,1,8,1; + light/line-join: round; + } + } #tunnels { line-dasharray: 5,3; } @@ -2615,6 +2632,15 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ dashes/line-width: 3; dashes/line-color: #999; dashes/line-dasharray: 1,10; + + [preserved = 'yes'] { + line/line-width: 3; + line/line-color: #bbb; + dashes/line-width: 1; + dashes/line-color: white; + dashes/line-dasharray: 0,1,8,1; + dashes/line-join: round; + } } } @@ -2648,6 +2674,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 2; } } + [preserved = 'yes'][zoom >= 15] { + #roads-fill, #bridges { + dark/line-width: 3; + dark/line-color: #999; + light/line-width: 1; + light/line-color: white; + light/line-dasharray: 0,1,8,1; + light/line-join: round; + } + } #tunnels { line-dasharray: 5,3; } @@ -2658,6 +2694,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [zoom >= 12] { line-width: 2; line-color: #999; + [preserved = 'yes'][zoom >= 15] { + #roads-fill, #bridges { + dark/line-width: 3; + dark/line-color: #999; + light/line-width: 1; + light/line-color: white; + light/line-dasharray: 0,1,8,1; + light/line-join: round; + } + } #tunnels { line-dasharray: 5,3; } @@ -2670,38 +2716,6 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ } } - [feature = 'railway_preserved'] { - [zoom >= 12] { - dark/line-width: 1.5; - dark/line-color: #aaa; - dark/line-join: round; - [zoom >= 13] { - dark/line-width: 3; - dark/line-color: #999999; - light/line-width: 1; - light/line-color: white; - light/line-dasharray: 0,1,8,1; - light/line-join: round; - } - } - } - - [feature = 'railway_INT-preserved-ssy'] { - [zoom >= 12] { - dark/line-width: 1; - dark/line-color: #aaa; - dark/line-join: round; - [zoom >= 13] { - dark/line-width: 2; - dark/line-color: #999999; - light/line-width: 0.8; - light/line-color: white; - light/line-dasharray: 0,1,8,1; - light/line-join: round; - } - } - } - [feature = 'railway_monorail'] { [zoom >= 14] { background/line-width: 4; @@ -2714,6 +2728,16 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line/line-dasharray: 2,3; line/line-cap: round; line/line-join: round; + + [preserved = 'yes'] { + line/line-color: #999; + background/line-color: white; + background/line-dasharray: 0,1,8,1; + } + + #tunnels { + line/line-dasharray: 3,4; + } } } @@ -4187,7 +4211,6 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [railway = 'subway'], [railway = 'narrow_gauge'], [railway = 'light_rail'], - [railway = 'preserved'], [railway = 'funicular'], [railway = 'monorail'], [railway = 'tram'] { @@ -4266,9 +4289,11 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ } } } - /* Other minor railway styles. For service rails, see: - https://github.com/gravitystorm/openstreetmap-carto/pull/2687 */ - [railway = 'preserved'], + + /* + Other minor railway styles. For service rails, see: + https://github.com/gravitystorm/openstreetmap-carto/pull/2687 + */ [railway = 'miniature'], [railway = 'disused'], [railway = 'construction'] {