From 5e3d4fccfef7b3937bfc48a0439a26c1a84f878b Mon Sep 17 00:00:00 2001 From: dch0ph Date: Thu, 23 Jan 2025 21:21:45 +0000 Subject: [PATCH 1/3] move guideways to roads layers Also tweak to SQL for link roads --- openstreetmap-carto-flex.lua | 2 ++ project.mml | 19 ++----------- style/roads.mss | 53 ++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 16 deletions(-) diff --git a/openstreetmap-carto-flex.lua b/openstreetmap-carto-flex.lua index 832cbe5a2..c15eb72a8 100644 --- a/openstreetmap-carto-flex.lua +++ b/openstreetmap-carto-flex.lua @@ -400,6 +400,8 @@ local roads_info = { primary_link = { z = 220, roads = true }, secondary_link = { z = 210, roads = true }, tertiary_link = { z = 200, roads = false }, + busway = {z = 190, roads = false}, + bus_guideway = {z = 180, roads = false}, service = { z = 150, roads = false }, track = { z = 110, roads = false }, path = { z = 100, roads = false }, diff --git a/project.mml b/project.mml index 8e9dce243..1f714b9b9 100644 --- a/project.mml +++ b/project.mml @@ -449,7 +449,7 @@ Layer: table: |- (SELECT way, - (CASE WHEN feature IN ('highway_motorway_link', 'highway_trunk_link', 'highway_primary_link', 'highway_secondary_link', 'highway_tertiary_link') THEN substr(feature, 0, length(feature)-4) ELSE feature END) AS feature, + CASE WHEN link = 'yes' THEN substr(feature, 0, length(feature)-4) ELSE feature END AS feature, tracktype, int_surface, int_access, @@ -698,7 +698,7 @@ Layer: table: &roads_sql |- (SELECT way, - (CASE WHEN feature IN ('highway_motorway_link', 'highway_trunk_link', 'highway_primary_link', 'highway_secondary_link', 'highway_tertiary_link') THEN substr(feature, 0, length(feature)-4) ELSE feature END) AS feature, + CASE WHEN link = 'yes' THEN substr(feature, 0, length(feature)-4) ELSE feature END AS feature, tracktype, int_surface, int_access, @@ -858,19 +858,6 @@ Layer: cache-features: true minzoom: 6 maxzoom: 9 - - id: guideways - geometry: linestring - <<: *extents - Datasource: - <<: *osm2pgsql - table: |- - (SELECT - way - FROM planet_osm_line - WHERE highway = 'bus_guideway' - ) AS guideways - properties: - minzoom: 11 - id: bridges geometry: linestring <<: *extents @@ -887,7 +874,7 @@ Layer: table: |- (SELECT way, - (CASE WHEN feature IN ('highway_motorway_link', 'highway_trunk_link', 'highway_primary_link', 'highway_secondary_link', 'highway_tertiary_link') THEN substr(feature, 0, length(feature)-4) ELSE feature END) AS feature, + CASE WHEN link = 'yes' THEN substr(feature, 0, length(feature)-4) ELSE feature END AS feature, tracktype, int_surface, int_access, diff --git a/style/roads.mss b/style/roads.mss index bbfabb4dc..32a55572f 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -65,6 +65,9 @@ @residential-tunnel-fill: darken(@residential-fill, 5%); @living-street-tunnel-fill: lighten(@living-street-fill, 3%); +@bus-guideway-fill: #6699ff; +@bus-guideway-tunnel-fill: lighten(desaturate(@bus-guideway-fill, 20%), 8%); + @motorway-width-z6: 0.4; @trunk-width-z6: 0.4; @@ -789,6 +792,13 @@ } } + [feature = 'highway_bus_guideway'][zoom >= 13] { + #bridges { + line-width: 6.5; + line-color: @bridge-casing; + line-join: round; + } + } [feature = 'railway_tram'], [feature = 'railway_tram-service'][zoom >= 15] { @@ -1018,6 +1028,14 @@ } } + [feature = 'highway_bus_guideway'][zoom >= 13] { + #bridges { + line-width: 5; + line-color: white; + line-join: round; + } + } + [feature = 'railway_rail'][zoom >= 13], [feature = 'railway_monorail'][zoom >= 14] { #bridges { @@ -2516,6 +2534,41 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ } } } + + [feature = 'highway_bus_guideway'][zoom >= 11] { + [zoom < 13] { + line-width: 0.6; + [zoom >= 12] { line-width: 1; } + #roads-fill, #bridges { + line-color: @bus-guideway-fill; + } + #tunnels { + line-color: @bus-guideway-tunnel-fill; + line-dasharray: 5,2; + } + } + [zoom >= 13] { + line-width: 3; + line-join: round; + #roads-fill, #bridges { + line-color: @bus-guideway-fill; + } + #tunnels { + line-color: @bus-guideway-tunnel-fill; + } + b/line-width: 1; + b/line-color: white; + b/line-dasharray: 8,12; + b/line-join: round; + [zoom >= 14] { + b/line-dasharray: 0,11,8,1; + } + [zoom >= 17] { + line-width: 5; + b/line-width: 2.5; + } + } + } [feature = 'railway_rail'][zoom >= 8][zoom < 10], [feature = 'railway_rail'][preserved != 'yes'][zoom >= 10][zoom < 12], From cf017058e700f3bb89072983a4246cfe27dce1f9 Mon Sep 17 00:00:00 2001 From: dch0ph Date: Thu, 23 Jan 2025 21:35:18 +0000 Subject: [PATCH 2/3] Render oneway for guided busway Also simplification of selectors --- project.mml | 2 +- style/roads.mss | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/project.mml b/project.mml index 1f714b9b9..06e48aaab 100644 --- a/project.mml +++ b/project.mml @@ -1933,7 +1933,7 @@ Layer: END AS oneway FROM planet_osm_line l WHERE highway IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', - 'tertiary_link', 'residential', 'unclassified', 'road', 'service', 'pedestrian', 'raceway', 'living_street', 'construction') + 'tertiary_link', 'residential', 'unclassified', 'road', 'service', 'pedestrian', 'raceway', 'living_street', 'construction', 'bus_guideway') AND (name IS NOT NULL OR oneway IN ('yes', '-1') OR junction IN ('roundabout')) diff --git a/style/roads.mss b/style/roads.mss index 32a55572f..2a4912300 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -306,6 +306,7 @@ @residential-oneway-arrow-color: darken(@residential-casing, 40%); @living-street-oneway-arrow-color: darken(@residential-casing, 30%); @pedestrian-oneway-arrow-color: darken(@pedestrian-casing, 25%); +@bus-guideway-oneway-arrow-color: darken(@bus-guideway-fill, 25%); @raceway-oneway-arrow-color: darken(@raceway-fill, 50%); @footway-oneway-arrow-color: darken(@footway-fill, 35%); @steps-oneway-arrow-color: darken(@steps-fill, 35%); @@ -4157,12 +4158,12 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [highway = 'residential'], [highway = 'unclassified'], [highway = 'living_street'], + [highway = 'bus_guideway'], [highway = 'road'], [highway = 'service'], [highway = 'pedestrian'], [highway = 'raceway'] { - [oneway = 'yes'], - [oneway = '-1'] { + [oneway != null] { marker-placement: line; marker-spacing: 180; marker-max-error: 0.5; @@ -4197,6 +4198,10 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [highway = 'service'] { marker-fill: @residential-oneway-arrow-color; } + [highway = 'bus_guideway'] { + marker-fill: @bus-guideway-oneway-arrow-color; + marker-offset: 7; + } [highway = 'living_street'] { marker-fill: @living-street-oneway-arrow-color; } @@ -4215,8 +4220,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [highway = 'path'], [highway = 'track'], [highway = 'bridleway'] { - [oneway = 'yes'], - [oneway = '-1'] { + [oneway != null] { text-name: "'🠖'"; text-size: 15; text-clip: false; From c4998e22c2bc938f6ff45957826155eafc64e54b Mon Sep 17 00:00:00 2001 From: dch0ph Date: Sun, 26 Jan 2025 17:11:37 +0000 Subject: [PATCH 3/3] Remove Z17+ width change Fix whitespace Remove width increase for Z17+ --- openstreetmap-carto-flex.lua | 4 ++-- style/roads.mss | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/openstreetmap-carto-flex.lua b/openstreetmap-carto-flex.lua index c15eb72a8..4f2611eac 100644 --- a/openstreetmap-carto-flex.lua +++ b/openstreetmap-carto-flex.lua @@ -400,8 +400,8 @@ local roads_info = { primary_link = { z = 220, roads = true }, secondary_link = { z = 210, roads = true }, tertiary_link = { z = 200, roads = false }, - busway = {z = 190, roads = false}, - bus_guideway = {z = 180, roads = false}, + busway = { z = 190, roads = false }, + bus_guideway = { z = 180, roads = false }, service = { z = 150, roads = false }, track = { z = 110, roads = false }, path = { z = 100, roads = false }, diff --git a/style/roads.mss b/style/roads.mss index 2a4912300..6e86e3000 100644 --- a/style/roads.mss +++ b/style/roads.mss @@ -2564,10 +2564,6 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */ [zoom >= 14] { b/line-dasharray: 0,11,8,1; } - [zoom >= 17] { - line-width: 5; - b/line-width: 2.5; - } } }