Skip to content

Commit

Permalink
Render highway=busway
Browse files Browse the repository at this point in the history
Initial fix for #4226.

Rendering is kept close to `highway=service` for this initial rendering
of a hitherto unrendered feature. The only digression from
`highway=service` is a distinctive colour based on the `highway=bus_guideway`
colour proposed in PR #4395.
  • Loading branch information
jdhoek committed Sep 3, 2021
1 parent 4ec2dc9 commit 95eebbf
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 5 deletions.
1 change: 1 addition & 0 deletions openstreetmap-carto.lua
Expand Up @@ -198,6 +198,7 @@ local roads_info = {
living_street = {z = 320, roads = false},
pedestrian = {z = 310, roads = false},
raceway = {z = 300, roads = false},
busway = {z = 330, roads = false},
motorway_link = {z = 240, roads = true},
trunk_link = {z = 230, roads = true},
primary_link = {z = 220, roads = true},
Expand Down
12 changes: 7 additions & 5 deletions project.mml
Expand Up @@ -645,8 +645,9 @@ Layer:
('unclassified', 4),
('residential', 5),
('living_street', 6),
('service', 7),
('track', 8)
('busway', 7),
('service', 8),
('track', 9)
) AS v (highway, prio)
ON v.highway = l.highway
WHERE p.highway IN (
Expand Down Expand Up @@ -1843,7 +1844,7 @@ Layer:
horse, bicycle
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', 'busway', 'pedestrian', 'raceway', 'living_street', 'construction')
AND (name IS NOT NULL
OR oneway IN ('yes', '-1')
OR junction IN ('roundabout'))
Expand Down Expand Up @@ -1938,17 +1939,18 @@ Layer:
SELECT
osm_id,
way,
CASE WHEN highway IN ('unclassified', 'residential', 'track') THEN highway END AS highway,
CASE WHEN highway IN ('unclassified', 'residential', 'track', 'busway') THEN highway END AS highway,
string_to_array(ref, ';') AS refs
FROM planet_osm_line
WHERE highway IN ('unclassified', 'residential', 'track')
WHERE highway IN ('unclassified', 'residential', 'track', 'busway')
AND ref IS NOT NULL
) AS p) AS q
WHERE height <= 4 AND width <= 11
ORDER BY
CASE
WHEN highway = 'unclassified' THEN 33
WHEN highway = 'residential' THEN 32
WHEN highway = 'busway' THEN 31
WHEN highway = 'track' THEN 30
END DESC NULLS LAST,
height DESC,
Expand Down
140 changes: 140 additions & 0 deletions style/roads.mss
Expand Up @@ -3,6 +3,7 @@
@tertiary-fill: #ffffff;
@residential-fill: #ffffff;
@service-fill: @residential-fill;
@busway-fill: #f2eef9;
@living-street-fill: #ededed;
@pedestrian-fill: #dddde8;
@raceway-fill: pink;
Expand All @@ -23,12 +24,14 @@
@helipad-fill: @aeroway-fill;
@access-marking: #eaeaea;
@access-marking-living-street: #cccccc;
@access-marking-busway: #cbbce6;

@default-casing: white;
@tertiary-casing: #8f8f8f;
@residential-casing: #bbb;
@road-casing: @residential-casing;
@service-casing: @residential-casing;
@busway-casing: #b099d9;
@living-street-casing: @residential-casing;
@pedestrian-casing: #999;
@path-casing: @default-casing;
Expand Down Expand Up @@ -126,6 +129,7 @@
@pedestrian-width-z14: 3;
@road-width-z14: 2;
@service-width-z14: 2;
@busway-width-z14: 2;
@steps-width-z14: 0.7;

@motorway-width-z15: 10;
Expand Down Expand Up @@ -156,6 +160,7 @@
@pedestrian-width-z16: 6;
@road-width-z16: 3.5;
@service-width-z16: 3.5;
@busway-width-z16: 3.5;
@minor-service-width-z16: 2;
@footway-width-z16: 1.3;
@cycleway-width-z16: 0.9;
Expand All @@ -175,6 +180,7 @@
@pedestrian-width-z17: 12;
@road-width-z17: 7;
@service-width-z17: 7;
@busway-width-z17: 7;
@minor-service-width-z17: 3.5;

@motorway-width-z18: 21;
Expand All @@ -192,6 +198,7 @@
@pedestrian-width-z18: 13;
@road-width-z18: 8.5;
@service-width-z18: 8.5;
@busway-width-z18: 8.5;
@minor-service-width-z18: 4.75;
@footway-width-z18: 1.3;
@cycleway-width-z18: 1;
Expand All @@ -211,13 +218,15 @@
@pedestrian-width-z19: 17;
@road-width-z19: 11;
@service-width-z19: 11;
@busway-width-z19: 11;
@minor-service-width-z19: 5.5;
@footway-width-z19: 1.6;
@cycleway-width-z19: 1.3;

@motorway-width-z20: 33;
@motorway-link-width-z20: 17;
@service-width-z20: 12;
@busway-width-z20: 12;
@minor-service-width-z20: 8.5;


Expand Down Expand Up @@ -298,6 +307,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%);
@busway-oneway-arrow-color: darken(@busway-fill, 30%);
@raceway-oneway-arrow-color: darken(@raceway-fill, 50%);
@footway-oneway-arrow-color: darken(@footway-fill, 35%);
@steps-oneway-arrow-color: darken(@steps-fill, 35%);
Expand Down Expand Up @@ -552,6 +562,29 @@
}
}

[feature = 'highway_busway'] {
[zoom >= 14] {
line-color: @busway-casing;
line-width: @service-width-z14;
[zoom >= 16] { line-width: @busway-width-z16; }
[zoom >= 17] { line-width: @busway-width-z17; }
[zoom >= 18] { line-width: @busway-width-z18; }
[zoom >= 19] { line-width: @busway-width-z19; }
[zoom >= 20] { line-width: @busway-width-z20; }
#roads-casing {
line-join: round;
line-cap: round;
}
#tunnels {
line-dasharray: 4,2;
}
#bridges {
line-color: @bridge-casing;
line-join: round;
}
}
}

[feature = 'highway_service'] {
[zoom >= 14][service = 'INT-normal'],
[zoom >= 16][service = 'INT-minor'] {
Expand Down Expand Up @@ -1282,6 +1315,27 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}
}

[construction = 'busway'][zoom >= 15] {
line-color: @busway-fill;
b/line-color: white;
b/line-dasharray: 6,4;
line-width: @busway-width-z14;
b/line-width: @busway-width-z14;
[zoom >= 16] {
line-width: @busway-width-z16;
b/line-width: @busway-width-z16 - 2 * @casing-width-z16;
b/line-dasharray: 8,6;
}
[zoom >= 17] {
line-width: @busway-width-z17;
b/line-width: @busway-width-z17 - 2 * @casing-width-z17;
}
[zoom >= 18] {
line-width: 8;
b/line-width: 7
}
}

[construction = 'service'] {
[zoom >= 15][service = 'INT-normal'],
[zoom >= 17][service = 'INT-minor'] {
Expand Down Expand Up @@ -1713,6 +1767,31 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}
}

[feature = 'highway_busway'] {
[zoom >= 14] {
line-color: @busway-fill;
line-width: @busway-width-z14 - 2 * @casing-width-z14;
[zoom >= 16] { line-width: @busway-width-z16 - 2 * @casing-width-z16; }
[zoom >= 17] { line-width: @busway-width-z17 - 2 * @casing-width-z17; }
[zoom >= 18] { line-width: @busway-width-z18 - 2 * @casing-width-z18; }
[zoom >= 19] { line-width: @busway-width-z19 - 2 * @casing-width-z19; }
[zoom >= 20] { line-width: @busway-width-z20 - 2 * @casing-width-z20; }
line-join: round;
line-cap: round;
#tunnels {
line-color: darken(white, 5%);
}
#bridges {
line-width: @busway-width-z14 - 2 * @bridge-casing-width-z14;
[zoom >= 16] { line-width: @busway-width-z16 - 2 * @bridge-casing-width-z16; }
[zoom >= 17] { line-width: @busway-width-z17 - 2 * @bridge-casing-width-z17; }
[zoom >= 18] { line-width: @busway-width-z18 - 2 * @bridge-casing-width-z18; }
[zoom >= 19] { line-width: @busway-width-z19 - 2 * @bridge-casing-width-z19; }
[zoom >= 20] { line-width: @busway-width-z20 - 2 * @bridge-casing-width-z20; }
}
}
}

[feature = 'highway_service'] {
[zoom >= 14][service = 'INT-normal'],
[zoom >= 16][service = 'INT-minor'] {
Expand Down Expand Up @@ -2437,6 +2516,31 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
marker-line-width: 0;
}

[int_tc_type = 'busway'][zoom >= 16] {
marker-fill: @busway-casing;
marker-width: @busway-width-z16 * 1.6 + 2 * @casing-width-z16;
marker-height: @busway-width-z16 * 1.6 + 2 * @casing-width-z16;
[zoom >= 17] {
marker-width: @busway-width-z17 * 1.6 + 2 * @casing-width-z17;
marker-height: @busway-width-z17 * 1.6 + 2 * @casing-width-z17;
}
[zoom >= 18] {
marker-width: @busway-width-z18 * 1.6 + 2 * @casing-width-z18;
marker-height: @busway-width-z18 * 1.6 + 2 * @casing-width-z18;
}
[zoom >= 19] {
marker-width: @busway-width-z19 * 1.6 + 2 * @casing-width-z19;
marker-height: @busway-width-z19 * 1.6 + 2 * @casing-width-z19;
}
[zoom >= 20] {
marker-width: @busway-width-z20 * 1.6 + 2 * @casing-width-z20;
marker-height: @busway-width-z20 * 1.6 + 2 * @casing-width-z20;
}
marker-allow-overlap: true;
marker-ignore-placement: true;
marker-line-width: 0;
}

[int_tc_type = 'service'][int_tc_service = 'INT-normal'][zoom >= 16] {
marker-fill: @service-casing;
marker-width: @service-width-z16 * 1.6 + 2 * @casing-width-z16;
Expand Down Expand Up @@ -2605,6 +2709,31 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
marker-line-width: 0;
}

[int_tc_type = 'busway'][zoom >= 16] {
marker-fill: @busway-fill;
marker-width: @busway-width-z16 * 1.6;
marker-height: @busway-width-z16 * 1.6;
[zoom >= 17] {
marker-width: @busway-width-z17 * 1.6;
marker-height: @busway-width-z17 * 1.6;
}
[zoom >= 18] {
marker-width: @busway-width-z18 * 1.6;
marker-height: @busway-width-z18 * 1.6;
}
[zoom >= 19] {
marker-width: @busway-width-z19 * 1.6;
marker-height: @busway-width-z19 * 1.6;
}
[zoom >= 20] {
marker-width: @busway-width-z20 * 1.6;
marker-height: @busway-width-z20 * 1.6;
}
marker-allow-overlap: true;
marker-ignore-placement: true;
marker-line-width: 0;
}

[int_tc_type = 'service'][int_tc_service = 'INT-normal'][zoom >= 16] {
marker-fill: @service-fill;
marker-width: @service-width-z16 * 1.6;
Expand Down Expand Up @@ -2864,6 +2993,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}
}
[feature = 'highway_road'],
[feature = 'highway_busway'],
[feature = 'highway_service'][service = 'INT-normal'] {
[zoom >= 15] {
access/line-color: @access-marking;
Expand Down Expand Up @@ -2915,9 +3045,13 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}
}
[feature = 'highway_road'],
[feature = 'highway_busway'],
[feature = 'highway_service'][service = 'INT-normal'] {
[zoom >= 15] {
access/line-color: @access-marking;
[feature = 'highway_busway'] {
access/line-color: @access-marking-busway;
}
access/line-join: round;
access/line-cap: round;
access/line-width: 2;
Expand Down Expand Up @@ -3338,6 +3472,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}

[highway = 'raceway'],
[highway = 'busway'],
[highway = 'service'],
[highway = 'construction'][construction = 'raceway'],
[highway = 'construction'][construction = 'service'][zoom >= 17] {
Expand All @@ -3350,6 +3485,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
text-placement: line;
text-halo-radius: @standard-halo-radius;
[highway = 'raceway'] { text-halo-fill: @raceway-fill; }
[highway = 'busway'] { text-halo-fill: @busway-fill; }
[highway = 'service'] { text-halo-fill: @service-fill; }
text-face-name: @book-fonts;
text-repeat-distance: @major-highway-text-repeat-distance;
Expand Down Expand Up @@ -3479,6 +3615,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[highway = 'unclassified'],
[highway = 'living_street'],
[highway = 'road'],
[highway = 'busway'],
[highway = 'service'],
[highway = 'pedestrian'],
[highway = 'raceway'] {
Expand Down Expand Up @@ -3524,6 +3661,9 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[highway = 'pedestrian'] {
marker-fill: @pedestrian-oneway-arrow-color;
}
[highway = 'busway'] {
marker-fill: @busway-oneway-arrow-color;
}
[highway = 'raceway'] {
marker-fill: @raceway-oneway-arrow-color;
}
Expand Down

0 comments on commit 95eebbf

Please sign in to comment.