From 38bd0dc6def205781c963ee5da8edd6c9207d211 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Sun, 5 May 2024 12:33:26 +0200 Subject: [PATCH 01/21] Ensure railways with railway:preserved=yes render as preserved railways --- project.mml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/project.mml b/project.mml index 8152046e5..29f3c0c99 100644 --- a/project.mml +++ b/project.mml @@ -200,7 +200,7 @@ Layer: 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') + CASE WHEN tunnel IN ('yes', 'culvert') OR waterway = 'canal' AND tunnel = 'flooded' THEN 'yes' ELSE 'no' END AS int_tunnel, 'no' AS bridge @@ -487,7 +487,8 @@ 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 = 'preserved' OR tags->'railway:preserved' = 'yes') AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + WHEN tags->'railway:preserved' = 'yes' THEN 'preserved' 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, @@ -727,7 +728,8 @@ 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 = 'preserved' OR tags->'railway:preserved' = 'yes') AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + WHEN tags->'railway:preserved' = 'yes' THEN 'preserved' 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, @@ -893,7 +895,7 @@ Layer: 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') + CASE WHEN tunnel IN ('yes', 'culvert') OR waterway = 'canal' AND tunnel = 'flooded' THEN 'yes' ELSE 'no' END AS int_tunnel, 'yes' AS bridge @@ -956,7 +958,8 @@ 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 = 'preserved' OR tags->'railway:preserved' = 'yes') AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + WHEN tags->'railway:preserved' = 'yes' THEN 'preserved' 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, @@ -1623,7 +1626,7 @@ Layer: ) AS feature, CASE WHEN access IN ('private', 'no', 'customers', 'permit', 'delivery') THEN 'restricted' ELSE 'yes' END AS int_access, CASE - WHEN "natural" IN ('peak', 'volcano', 'saddle') + WHEN "natural" IN ('peak', 'volcano', 'saddle') OR tags->'mountain_pass' = 'yes' THEN CASE WHEN tags->'ele' ~ '^-?\d{1,4}(\.\d+)?$' THEN (tags->'ele')::NUMERIC @@ -1975,7 +1978,8 @@ Layer: table: |- (SELECT way, - CASE WHEN railway = 'preserved' AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + CASE WHEN (railway = 'preserved' OR tags->'railway:preserved' = 'yes') AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + WHEN tags->'railway:preserved' = 'yes' THEN 'preserved' 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, @@ -2204,7 +2208,7 @@ Layer: 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') + CASE WHEN tunnel IN ('yes', 'culvert') OR waterway = 'canal' AND tunnel = 'flooded' THEN 'yes' ELSE 'no' END AS int_tunnel FROM planet_osm_line From 1cf246b23fc8b07fb64f369f8d92f7e03140aba6 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Sun, 5 May 2024 12:55:53 +0200 Subject: [PATCH 02/21] Take only railway=rail --- project.mml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/project.mml b/project.mml index 29f3c0c99..29a9c5b16 100644 --- a/project.mml +++ b/project.mml @@ -487,8 +487,8 @@ Layer: UNION ALL SELECT way, - 'railway_' || (CASE WHEN (railway = 'preserved' OR tags->'railway:preserved' = 'yes') AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text - WHEN tags->'railway:preserved' = 'yes' THEN 'preserved' + 'railway_' || (CASE WHEN (railway = 'preserved' OR (railway = 'rail' AND tags->'railway:preserved' = 'yes')) AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + WHEN (railway = 'rail' AND tags->'railway:preserved' = 'yes') THEN 'preserved' 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, @@ -728,8 +728,8 @@ Layer: UNION ALL SELECT way, - ('railway_' || (CASE WHEN (railway = 'preserved' OR tags->'railway:preserved' = 'yes') AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text - WHEN tags->'railway:preserved' = 'yes' THEN 'preserved' + ('railway_' || (CASE WHEN (railway = 'preserved' OR (railway = 'rail' AND tags->'railway:preserved' = 'yes')) AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + WHEN (railway = 'rail' AND tags->'railway:preserved' = 'yes') THEN 'preserved' 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, @@ -958,8 +958,8 @@ Layer: UNION ALL SELECT way, - 'railway_' || (CASE WHEN (railway = 'preserved' OR tags->'railway:preserved' = 'yes') AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text - WHEN tags->'railway:preserved' = 'yes' THEN 'preserved' + 'railway_' || (CASE WHEN (railway = 'preserved' OR (railway = 'rail' AND tags->'railway:preserved' = 'yes')) AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + WHEN (railway = 'rail' AND tags->'railway:preserved' = 'yes') THEN 'preserved' 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, @@ -1978,8 +1978,8 @@ Layer: table: |- (SELECT way, - CASE WHEN (railway = 'preserved' OR tags->'railway:preserved' = 'yes') AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text - WHEN tags->'railway:preserved' = 'yes' THEN 'preserved' + CASE WHEN (railway = 'preserved' OR (railway = 'rail' AND tags->'railway:preserved' = 'yes')) AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text + WHEN (railway = 'rail' AND tags->'railway:preserved' = 'yes') = 'yes' THEN 'preserved' 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, From 5ae7128959a8dc108de8bfa6a437e3a10233da88 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Mon, 6 May 2024 20:58:54 +0200 Subject: [PATCH 03/21] Render railway=preserved as railway=rail --- project.mml | 67 +++++++++++++++++++++++++++++++++---------------- style/roads.mss | 48 +++++++++++++++++++++-------------- 2 files changed, 74 insertions(+), 41 deletions(-) diff --git a/project.mml b/project.mml index 29a9c5b16..c25e5d391 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,9 +489,9 @@ Layer: UNION ALL SELECT way, - 'railway_' || (CASE WHEN (railway = 'preserved' OR (railway = 'rail' AND tags->'railway:preserved' = 'yes')) AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text - WHEN (railway = 'rail' AND tags->'railway:preserved' = 'yes') THEN 'preserved' - WHEN (railway = 'rail' AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' + 'railway_' || (CASE + WHEN (railway IN ('rail', 'preserved') AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' + WHEN railway = 'preserved' THEN 'rail' WHEN (railway = 'tram' AND service IN ('spur', 'siding', 'yard')) THEN 'tram-service' ELSE railway END) AS feature, horse, @@ -504,6 +506,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 railway IN ('rail', 'preserved', 'narrow_gauge', 'tram') AND tags->'railway:preserved' = 'yes' THEN 'yes' + ELSE 'no' + END) AS preserved, COALESCE(layer,0) AS layernotnull, z_order FROM planet_osm_line @@ -514,7 +520,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 preserved = 'yes' OR 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 @@ -691,6 +697,7 @@ Layer: construction, service, link, + preserved, layernotnull FROM ( -- subselect that contains both roads and rail/aero SELECT @@ -717,6 +724,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 @@ -728,11 +736,11 @@ Layer: UNION ALL SELECT way, - ('railway_' || (CASE WHEN (railway = 'preserved' OR (railway = 'rail' AND tags->'railway:preserved' = 'yes')) AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text - WHEN (railway = 'rail' AND tags->'railway:preserved' = 'yes') THEN 'preserved' - 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 IN ('rail', 'preserved') AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' + WHEN railway = 'preserved' THEN 'rail' + WHEN (railway = 'tram' AND service IN ('spur', 'siding', 'yard')) THEN 'tram-service' + ELSE railway END) AS feature, horse, foot, bicycle, @@ -750,6 +758,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 railway IN ('rail', 'preserved', 'narrow_gauge', 'tram') AND tags->'railway:preserved' = 'yes' THEN 'yes' + ELSE 'no' + END) AS preserved, COALESCE(layer,0) AS layernotnull, osm_id, z_order @@ -764,7 +776,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 preserved = 'yes' OR 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 @@ -862,8 +874,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, @@ -874,7 +885,7 @@ 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', 'tram', 'light_rail', 'funicular', 'narrow_gauge') AND (service IS NULL OR service NOT IN ('spur', 'siding', 'yard'))) ORDER BY z_order @@ -924,6 +935,7 @@ Layer: construction, service, link, + preserved, layernotnull FROM ( -- subselect that contains both roads and rail/aero SELECT @@ -950,6 +962,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 @@ -958,9 +971,9 @@ Layer: UNION ALL SELECT way, - 'railway_' || (CASE WHEN (railway = 'preserved' OR (railway = 'rail' AND tags->'railway:preserved' = 'yes')) AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text - WHEN (railway = 'rail' AND tags->'railway:preserved' = 'yes') THEN 'preserved' - WHEN (railway = 'rail' AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' + 'railway_' || (CASE + WHEN (railway IN ('rail', 'preserved') AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' + WHEN railway = 'preserved' THEN 'rail' WHEN (railway = 'tram' AND service IN ('spur', 'siding', 'yard')) THEN 'tram-service' ELSE railway END) AS feature, horse, @@ -975,6 +988,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 railway IN ('rail', 'preserved', 'narrow_gauge', 'tram') AND tags->'railway:preserved' = 'yes' THEN 'yes' + ELSE 'no' + END) AS preserved, COALESCE(layer,0) AS layernotnull, z_order FROM planet_osm_line @@ -985,7 +1002,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 preserved = 'yes' OR 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 @@ -1978,15 +1995,21 @@ Layer: table: |- (SELECT way, - CASE WHEN (railway = 'preserved' OR (railway = 'rail' AND tags->'railway:preserved' = 'yes')) AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text - WHEN (railway = 'rail' AND tags->'railway:preserved' = 'yes') = 'yes' THEN 'preserved' - 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 IN ('rail', 'preserved') AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' + WHEN railway = 'preserved' THEN 'rail' + 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 railway IN ('rail', 'preserved', 'narrow_gauge', 'tram') AND 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') diff --git a/style/roads.mss b/style/roads.mss index e6d9d338f..8c3c5c85e 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -793,7 +793,9 @@ [feature = 'railway_tram'], - [feature = 'railway_tram-service'][zoom >= 15] { + [feature = 'railway_tram_preserved'], + [feature = 'railway_tram-service'][zoom >= 15], + [feature = 'railway_tram-service_preserved'][zoom >= 15] { #bridges { [zoom >= 13] { line-width: 4; @@ -819,7 +821,8 @@ [feature = 'railway_light_rail'], [feature = 'railway_funicular'], - [feature = 'railway_narrow_gauge'] { + [feature = 'railway_narrow_gauge'], + [feature = 'railway_narrow_gauge_preserved'] { #bridges { [zoom >= 14] { line-width: 5.5; @@ -830,7 +833,7 @@ } [feature = 'railway_rail'], - [feature = 'railway_preserved'], + [feature = 'railway_rail_preserved'], [feature = 'railway_monorail'][zoom >= 14] { #bridges { [zoom >= 13] { @@ -841,7 +844,8 @@ } } - [feature = 'railway_INT-spur-siding-yard'] { + [feature = 'railway_INT-spur-siding-yard'], + [feature = 'railway_INT-spur-siding-yard_preserved'] { #bridges { [zoom >= 13] { line-width: 5.7; @@ -853,8 +857,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 +1028,7 @@ } [feature = 'railway_rail'][zoom >= 13], - [feature = 'railway_preserved'][zoom >= 13], + [feature = 'railway_rail_preserved'][zoom >= 13], [feature = 'railway_monorail'][zoom >= 14] { #bridges { line-width: 5; @@ -1034,7 +1037,8 @@ } } - [feature = 'railway_INT-spur-siding-yard'] { + [feature = 'railway_INT-spur-siding-yard'], + [feature = 'railway_INT-spur-siding-yard_preserved'] { #bridges { [zoom >= 13] { line-width: 4; @@ -1046,8 +1050,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; @@ -1058,7 +1061,9 @@ } [feature = 'railway_tram'], - [feature = 'railway_tram-service'][zoom >= 15] { + [feature = 'railway_tram_preserved'], + [feature = 'railway_tram-service'][zoom >= 15], + [feature = 'railway_tram-service_preserved'][zoom >= 15] { #bridges { [zoom >= 13] { line-width: 3; @@ -1083,7 +1088,8 @@ [feature = 'railway_light_rail'], [feature = 'railway_funicular'], - [feature = 'railway_narrow_gauge'] { + [feature = 'railway_narrow_gauge'], + [feature = 'railway_narrow_gauge_preserved'] { #bridges { [zoom >= 14] { line-width: 4; @@ -4183,14 +4189,13 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ #railways-text-name { /* Mostly started from z17. */ - [railway = 'rail'], + [railway = 'rail'][preserved != 'yes'], [railway = 'subway'], - [railway = 'narrow_gauge'], + [railway = 'narrow_gauge'][preserved != 'yes'], [railway = 'light_rail'], - [railway = 'preserved'], [railway = 'funicular'], [railway = 'monorail'], - [railway = 'tram'] { + [railway = 'tram'][preserved != 'yes'] { [zoom >= 17] { text-name: "[name]"; text-fill: #666666; @@ -4266,9 +4271,14 @@ 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 = 'rail'][preserved = 'yes'], + [railway = 'narrow_gauge'][preserved = 'yes'], + [railway = 'tram'][preserved = 'yes'], [railway = 'miniature'], [railway = 'disused'], [railway = 'construction'] { From 5b2c452f0972811554c7d5ff0f6adc8141b104b6 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Mon, 6 May 2024 22:02:36 +0200 Subject: [PATCH 04/21] Render preserved with new rules --- style/roads.mss | 77 ++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/style/roads.mss b/style/roads.mss index 8c3c5c85e..5fe8d073d 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -793,9 +793,7 @@ [feature = 'railway_tram'], - [feature = 'railway_tram_preserved'], - [feature = 'railway_tram-service'][zoom >= 15], - [feature = 'railway_tram-service_preserved'][zoom >= 15] { + [feature = 'railway_tram-service'][zoom >= 15] { #bridges { [zoom >= 13] { line-width: 4; @@ -821,8 +819,7 @@ [feature = 'railway_light_rail'], [feature = 'railway_funicular'], - [feature = 'railway_narrow_gauge'], - [feature = 'railway_narrow_gauge_preserved'] { + [feature = 'railway_narrow_gauge'] { #bridges { [zoom >= 14] { line-width: 5.5; @@ -833,7 +830,6 @@ } [feature = 'railway_rail'], - [feature = 'railway_rail_preserved'], [feature = 'railway_monorail'][zoom >= 14] { #bridges { [zoom >= 13] { @@ -844,8 +840,7 @@ } } - [feature = 'railway_INT-spur-siding-yard'], - [feature = 'railway_INT-spur-siding-yard_preserved'] { + [feature = 'railway_INT-spur-siding-yard'] { #bridges { [zoom >= 13] { line-width: 5.7; @@ -1028,7 +1023,6 @@ } [feature = 'railway_rail'][zoom >= 13], - [feature = 'railway_rail_preserved'][zoom >= 13], [feature = 'railway_monorail'][zoom >= 14] { #bridges { line-width: 5; @@ -1037,8 +1031,7 @@ } } - [feature = 'railway_INT-spur-siding-yard'], - [feature = 'railway_INT-spur-siding-yard_preserved'] { + [feature = 'railway_INT-spur-siding-yard'] { #bridges { [zoom >= 13] { line-width: 4; @@ -1061,9 +1054,7 @@ } [feature = 'railway_tram'], - [feature = 'railway_tram_preserved'], - [feature = 'railway_tram-service'][zoom >= 15], - [feature = 'railway_tram-service_preserved'][zoom >= 15] { + [feature = 'railway_tram-service'][zoom >= 15] { #bridges { [zoom >= 13] { line-width: 3; @@ -1088,8 +1079,7 @@ [feature = 'railway_light_rail'], [feature = 'railway_funicular'], - [feature = 'railway_narrow_gauge'], - [feature = 'railway_narrow_gauge_preserved'] { + [feature = 'railway_narrow_gauge'] { #bridges { [zoom >= 14] { line-width: 4; @@ -2577,6 +2567,11 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ light/line-width: 1; } } + [preserved = 'yes'] { + dark/line-color: #999999; + light/line-color: white; + light/line-dasharray: 0,1,8,1; + } } #tunnels { line-color: #787878; @@ -2588,7 +2583,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] { @@ -2608,6 +2603,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [zoom >= 13] { line-color: #666; } line-width: 1; [zoom >= 13] { line-width: 2; } + [feature = 'railway_narrow_gauge'][preserved = 'yes'][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; + } #tunnels { line-dasharray: 5,3; } @@ -2654,6 +2657,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 2; } } + [feature = 'railway_tram'][preserved = 'yes'][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; + } #tunnels { line-dasharray: 5,3; } @@ -2676,38 +2687,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; From 6062c94e38db96199bdaed9aefe2fc5ea1660828 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Wed, 8 May 2024 21:18:32 +0200 Subject: [PATCH 05/21] include more railway tags to allow `railway:preserved=yes` --- project.mml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project.mml b/project.mml index c25e5d391..3dcdcbfb9 100644 --- a/project.mml +++ b/project.mml @@ -507,7 +507,7 @@ Layer: 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 railway IN ('rail', 'preserved', 'narrow_gauge', 'tram') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'preserved', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, @@ -759,7 +759,7 @@ Layer: 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 railway IN ('rail', 'preserved', 'narrow_gauge', 'tram') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'preserved', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, @@ -989,7 +989,7 @@ Layer: 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 railway IN ('rail', 'preserved', 'narrow_gauge', 'tram') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'preserved', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, @@ -2007,7 +2007,7 @@ Layer: construction, name, (CASE - WHEN railway IN ('rail', 'preserved', 'narrow_gauge', 'tram') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'preserved', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved FROM planet_osm_line l From 0b723b2b4ae49c8bfa8b11c1e5150fcca27b6129 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Wed, 8 May 2024 21:41:13 +0200 Subject: [PATCH 06/21] Ensure all types of railways have styles aligned --- style/roads.mss | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/style/roads.mss b/style/roads.mss index 5fe8d073d..a44f460ca 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2603,7 +2603,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [zoom >= 13] { line-color: #666; } line-width: 1; [zoom >= 13] { line-width: 2; } - [feature = 'railway_narrow_gauge'][preserved = 'yes'][zoom >= 13] { + [preserved = 'yes'][zoom >= 13] { dark/line-width: 3; dark/line-color: #999999; light/line-width: 1; @@ -2624,6 +2624,13 @@ 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; + dashes/line-join: round; + + [preserved = 'yes'] { + line/line-color: #999999; + dashes/line-color: white; + dashes/line-dasharray: 0,1,8,1; + } } } @@ -2657,7 +2664,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 2; } } - [feature = 'railway_tram'][preserved = 'yes'][zoom >= 13] { + [preserved = 'yes'] { dark/line-width: 3; dark/line-color: #999999; light/line-width: 1; @@ -2675,6 +2682,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [zoom >= 12] { line-width: 2; line-color: #999; + [preserved = 'yes'] { + 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; + } #tunnels { line-dasharray: 5,3; } @@ -2699,6 +2714,12 @@ 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'] { + background/line-color: #999999; + line/line-color: white; + line/line-dasharray: 0,1,8,1; + } } } @@ -2724,6 +2745,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 2; line-dasharray: 2,4; line-join: round; + [preserved = 'yes'] { + 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; + } } } @@ -4168,13 +4197,13 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ #railways-text-name { /* Mostly started from z17. */ - [railway = 'rail'][preserved != 'yes'], + [railway = 'rail'], [railway = 'subway'], - [railway = 'narrow_gauge'][preserved != 'yes'], + [railway = 'narrow_gauge'], [railway = 'light_rail'], [railway = 'funicular'], [railway = 'monorail'], - [railway = 'tram'][preserved != 'yes'] { + [railway = 'tram'] { [zoom >= 17] { text-name: "[name]"; text-fill: #666666; @@ -4255,9 +4284,6 @@ 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 = 'rail'][preserved = 'yes'], - [railway = 'narrow_gauge'][preserved = 'yes'], - [railway = 'tram'][preserved = 'yes'], [railway = 'miniature'], [railway = 'disused'], [railway = 'construction'] { From 992a6fc4bf40ccff06bd2f1e2b3f25f23f7300a9 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Wed, 8 May 2024 22:03:31 +0200 Subject: [PATCH 07/21] improve rendering for edge cases --- style/roads.mss | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/style/roads.mss b/style/roads.mss index a44f460ca..ae1ee4d7f 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2627,9 +2627,12 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ dashes/line-join: round; [preserved = 'yes'] { + line/line-width: 3; line/line-color: #999999; + dashes/line-width: 1; dashes/line-color: white; dashes/line-dasharray: 0,1,8,1; + dashes/line-join: round; } } } @@ -2716,9 +2719,9 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line/line-join: round; [preserved = 'yes'] { - background/line-color: #999999; - line/line-color: white; - line/line-dasharray: 0,1,8,1; + line/line-color: #999999; + background/line-color: white; + background/line-dasharray: 0,1,8,1; } } } @@ -2745,14 +2748,6 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 2; line-dasharray: 2,4; line-join: round; - [preserved = 'yes'] { - 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; - } } } From 7d86dedbce703170bc7be64cc5f44b806ce98798 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Wed, 8 May 2024 22:18:48 +0200 Subject: [PATCH 08/21] Fixup railway line widths --- style/roads.mss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/style/roads.mss b/style/roads.mss index ae1ee4d7f..8688d3293 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2549,7 +2549,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] { @@ -2568,7 +2568,9 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ } } [preserved = 'yes'] { + dark/line-width: 3; dark/line-color: #999999; + light/line-width: 1; light/line-color: white; light/line-dasharray: 0,1,8,1; } From 3170c0d008efa225d4c19d0494c973f6a3120dc2 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Wed, 8 May 2024 22:26:30 +0200 Subject: [PATCH 09/21] align colors a bit better with existing line colors --- style/roads.mss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/style/roads.mss b/style/roads.mss index 8688d3293..f1f816612 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2607,7 +2607,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [zoom >= 13] { line-width: 2; } [preserved = 'yes'][zoom >= 13] { dark/line-width: 3; - dark/line-color: #999999; + dark/line-color: #666; light/line-width: 1; light/line-color: white; light/line-dasharray: 0,1,8,1; @@ -2671,7 +2671,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ } [preserved = 'yes'] { dark/line-width: 3; - dark/line-color: #999999; + dark/line-color: #6E6E6E; light/line-width: 1; light/line-color: white; light/line-dasharray: 0,1,8,1; From 2935f7257e93f920abc91904b03c7acbbac493e1 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Thu, 9 May 2024 17:25:10 +0200 Subject: [PATCH 10/21] Render preserved railways and tram style only from z15 --- style/roads.mss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/style/roads.mss b/style/roads.mss index f1f816612..fc77a2d20 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2669,7 +2669,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 2; } } - [preserved = 'yes'] { + [preserved = 'yes'][zoom >= 15] { dark/line-width: 3; dark/line-color: #6E6E6E; light/line-width: 1; @@ -2687,7 +2687,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [zoom >= 12] { line-width: 2; line-color: #999; - [preserved = 'yes'] { + [preserved = 'yes'][zoom >= 15] { dark/line-width: 3; dark/line-color: #999999; light/line-width: 1; From 758c2405f339568b69f10db7ef1e254ba01669a8 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Thu, 9 May 2024 22:07:01 +0200 Subject: [PATCH 11/21] Tweak color prominence and ensure tunnels do not render preservedness --- style/roads.mss | 50 +++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/style/roads.mss b/style/roads.mss index fc77a2d20..6bd813f7b 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2569,7 +2569,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ } [preserved = 'yes'] { dark/line-width: 3; - dark/line-color: #999999; + dark/line-color: #666; light/line-width: 1; light/line-color: white; light/line-dasharray: 0,1,8,1; @@ -2606,12 +2606,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 1; [zoom >= 13] { line-width: 2; } [preserved = 'yes'][zoom >= 13] { - dark/line-width: 3; - dark/line-color: #666; - light/line-width: 1; - light/line-color: white; - light/line-dasharray: 0,1,8,1; - light/line-join: round; + #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; @@ -2630,7 +2632,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [preserved = 'yes'] { line/line-width: 3; - line/line-color: #999999; + line/line-color: #bbb; dashes/line-width: 1; dashes/line-color: white; dashes/line-dasharray: 0,1,8,1; @@ -2670,12 +2672,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ } } [preserved = 'yes'][zoom >= 15] { - dark/line-width: 3; - dark/line-color: #6E6E6E; - light/line-width: 1; - light/line-color: white; - light/line-dasharray: 0,1,8,1; - light/line-join: round; + #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; @@ -2688,12 +2692,14 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line-width: 2; line-color: #999; [preserved = 'yes'][zoom >= 15] { - 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; + #roads-fill, #bridges { + 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; + } } #tunnels { line-dasharray: 5,3; @@ -2725,6 +2731,10 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ background/line-color: white; background/line-dasharray: 0,1,8,1; } + + #tunnels { + line/line-dasharray: 3,4; + } } } From aaf5fe23eba95a5116c40c6475e15738add27f35 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Thu, 9 May 2024 22:11:09 +0200 Subject: [PATCH 12/21] ignore rail=preserved in ordering function --- project.mml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project.mml b/project.mml index 3dcdcbfb9..7c8a6c8d3 100644 --- a/project.mml +++ b/project.mml @@ -520,7 +520,7 @@ Layer: layernotnull, z_order, CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END, - CASE WHEN preserved = 'yes' OR feature IN ('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 @@ -776,7 +776,7 @@ Layer: layernotnull, z_order, CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END, - CASE WHEN preserved = 'yes' OR feature IN ('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 @@ -1002,7 +1002,7 @@ Layer: layernotnull, z_order, CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END, - CASE WHEN preserved = 'yes' OR feature IN ('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 From 0581639fecfb55e60463816bad03dc600298ba74 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Fri, 10 May 2024 09:41:00 +0200 Subject: [PATCH 13/21] No longer railway preserved as railway=rail --- project.mml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/project.mml b/project.mml index 7c8a6c8d3..86e976475 100644 --- a/project.mml +++ b/project.mml @@ -490,8 +490,7 @@ Layer: SELECT way, 'railway_' || (CASE - WHEN (railway IN ('rail', 'preserved') AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' - WHEN railway = 'preserved' THEN 'rail' + 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, @@ -507,7 +506,7 @@ Layer: 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 railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'preserved', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, @@ -737,8 +736,7 @@ Layer: SELECT way, 'railway_' || (CASE - WHEN (railway IN ('rail', 'preserved') AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' - WHEN railway = 'preserved' THEN 'rail' + 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, @@ -759,7 +757,7 @@ Layer: 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 railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'preserved', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, @@ -972,8 +970,7 @@ Layer: SELECT way, 'railway_' || (CASE - WHEN (railway IN ('rail', 'preserved') AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' - WHEN railway = 'preserved' THEN 'rail' + 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, @@ -989,7 +986,7 @@ Layer: 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 railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'preserved', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, @@ -1996,8 +1993,7 @@ Layer: (SELECT way, CASE - WHEN (railway IN ('rail', 'preserved') AND service IN ('spur', 'siding', 'yard')) THEN 'INT-spur-siding-yard' - WHEN railway = 'preserved' THEN 'rail' + 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, @@ -2007,12 +2003,11 @@ Layer: construction, name, (CASE - WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'preserved', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'subway', 'tram', 'monorail', 'disused') AND 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 From d75fa6f179dd266f61cc027e4ede53545333a32f Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Fri, 10 May 2024 20:50:57 +0200 Subject: [PATCH 14/21] revert some trailing whitespace --- project.mml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project.mml b/project.mml index 86e976475..ea9803c84 100644 --- a/project.mml +++ b/project.mml @@ -200,7 +200,7 @@ Layer: 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') + CASE WHEN tunnel IN ('yes', 'culvert') OR waterway = 'canal' AND tunnel = 'flooded' THEN 'yes' ELSE 'no' END AS int_tunnel, 'no' AS bridge @@ -904,7 +904,7 @@ Layer: 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') + CASE WHEN tunnel IN ('yes', 'culvert') OR waterway = 'canal' AND tunnel = 'flooded' THEN 'yes' ELSE 'no' END AS int_tunnel, 'yes' AS bridge @@ -1640,7 +1640,7 @@ Layer: ) AS feature, CASE WHEN access IN ('private', 'no', 'customers', 'permit', 'delivery') THEN 'restricted' ELSE 'yes' END AS int_access, CASE - WHEN "natural" IN ('peak', 'volcano', 'saddle') + WHEN "natural" IN ('peak', 'volcano', 'saddle') OR tags->'mountain_pass' = 'yes' THEN CASE WHEN tags->'ele' ~ '^-?\d{1,4}(\.\d+)?$' THEN (tags->'ele')::NUMERIC @@ -2226,7 +2226,7 @@ Layer: 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') + CASE WHEN tunnel IN ('yes', 'culvert') OR waterway = 'canal' AND tunnel = 'flooded' THEN 'yes' ELSE 'no' END AS int_tunnel FROM planet_osm_line From 5bc5e385df3c86c1fcf6470ee87a89c85dc8ea58 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Fri, 10 May 2024 20:53:55 +0200 Subject: [PATCH 15/21] Simplify railway preserved check --- project.mml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project.mml b/project.mml index ea9803c84..1c4b61fc9 100644 --- a/project.mml +++ b/project.mml @@ -506,7 +506,7 @@ Layer: 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 railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, @@ -757,7 +757,7 @@ Layer: 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 railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, @@ -986,7 +986,7 @@ Layer: 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 railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved, COALESCE(layer,0) AS layernotnull, From 41e05083530f97102a39aa57bd58c1822275b8fd Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Fri, 10 May 2024 21:12:46 +0200 Subject: [PATCH 16/21] ensure color syntax is aligned --- style/roads.mss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/style/roads.mss b/style/roads.mss index 6bd813f7b..e5fd8f99a 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2694,7 +2694,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [preserved = 'yes'][zoom >= 15] { #roads-fill, #bridges { dark/line-width: 3; - dark/line-color: #999999; + dark/line-color: #999; light/line-width: 1; light/line-color: white; light/line-dasharray: 0,1,8,1; @@ -2727,7 +2727,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ line/line-join: round; [preserved = 'yes'] { - line/line-color: #999999; + line/line-color: #999; background/line-color: white; background/line-dasharray: 0,1,8,1; } From f2fbd8956a3e92c3052d286639fbab4275ca4170 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Fri, 10 May 2024 21:21:05 +0200 Subject: [PATCH 17/21] simplify changeset --- style/roads.mss | 1 - 1 file changed, 1 deletion(-) diff --git a/style/roads.mss b/style/roads.mss index e5fd8f99a..971d119e1 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2628,7 +2628,6 @@ 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; - dashes/line-join: round; [preserved = 'yes'] { line/line-width: 3; From 9d615b79ba465b12d5dccc364e5086aaacd29195 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Sat, 11 May 2024 11:09:27 +0200 Subject: [PATCH 18/21] low zooms: do not query preserved railways --- project.mml | 1 + symbols/generating_patterns/scrub.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/project.mml b/project.mml index 1c4b61fc9..3a346de48 100644 --- a/project.mml +++ b/project.mml @@ -884,6 +884,7 @@ Layer: FROM planet_osm_roads WHERE highway IS NOT NULL OR (railway IN ('rail', 'tram', '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 diff --git a/symbols/generating_patterns/scrub.md b/symbols/generating_patterns/scrub.md index 3809ab907..c0e0675e7 100644 --- a/symbols/generating_patterns/scrub.md +++ b/symbols/generating_patterns/scrub.md @@ -6,4 +6,4 @@ Generated SVG image is sanitized for use with Mapnik by the script svg_pattern.s The final file is scrub.svg -Because of a [problem in the rendering stack](https://github.com/gravitystorm/openstreetmap-carto/issues/2750) we don’t use the SVG directly, but convert it to PNG: see symbols/scrub.png \ No newline at end of file +Because of a [problem in the rendering stack](https://github.com/gravitystorm/openstreetmap-carto/issues/2750) we don’t use the SVG directly, but convert it to PNG: see symbols/scrub.png From 8b0385c32f91d6e20755f3a4e6866f2dbbe55383 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Sat, 11 May 2024 11:19:40 +0200 Subject: [PATCH 19/21] low zooms: do not render preserved railways --- project.mml | 2 +- style/roads.mss | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/project.mml b/project.mml index 3a346de48..9c298139f 100644 --- a/project.mml +++ b/project.mml @@ -883,7 +883,7 @@ Layer: END AS int_surface FROM planet_osm_roads WHERE highway IS NOT NULL - OR (railway IN ('rail', 'tram', 'light_rail', 'funicular', 'narrow_gauge') + 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 diff --git a/style/roads.mss b/style/roads.mss index 971d119e1..a1ba5f44f 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2523,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; @@ -2599,7 +2601,9 @@ 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; } From 5908225665d61220246911ac9f98b84aa8ffd5ea Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Sat, 11 May 2024 11:21:32 +0200 Subject: [PATCH 20/21] revert whitespace --- symbols/generating_patterns/scrub.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/symbols/generating_patterns/scrub.md b/symbols/generating_patterns/scrub.md index c0e0675e7..3809ab907 100644 --- a/symbols/generating_patterns/scrub.md +++ b/symbols/generating_patterns/scrub.md @@ -6,4 +6,4 @@ Generated SVG image is sanitized for use with Mapnik by the script svg_pattern.s The final file is scrub.svg -Because of a [problem in the rendering stack](https://github.com/gravitystorm/openstreetmap-carto/issues/2750) we don’t use the SVG directly, but convert it to PNG: see symbols/scrub.png +Because of a [problem in the rendering stack](https://github.com/gravitystorm/openstreetmap-carto/issues/2750) we don’t use the SVG directly, but convert it to PNG: see symbols/scrub.png \ No newline at end of file From 0b9784f1ca4c917f34c58992bb06333719e4ffbe Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Tue, 21 May 2024 21:01:27 +0200 Subject: [PATCH 21/21] Fix specific preserved check in railway name layer --- project.mml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.mml b/project.mml index 9c298139f..b18e39b7c 100644 --- a/project.mml +++ b/project.mml @@ -2004,7 +2004,7 @@ Layer: construction, name, (CASE - WHEN railway IN ('rail', 'light_rail', 'funicular', 'narrow_gauge', 'miniature', 'subway', 'tram', 'monorail', 'disused') AND tags->'railway:preserved' = 'yes' THEN 'yes' + WHEN tags->'railway:preserved' = 'yes' THEN 'yes' ELSE 'no' END) AS preserved FROM planet_osm_line l