Skip to content

Commit

Permalink
Add missing oneway arrows for tracks and paths (#3614)
Browse files Browse the repository at this point in the history
* Add oneway arrows for tracks and paths

Fixed rendering of arrows on footways: these will always use the footway color, rather than changing if there is designated=bicycle or designated=bridleway
Fix bridleway arrow color: based on brideway color instead of track color now.
Fix merge conflict in project.mml

* Darken steps and bridleway oneway arrows

Steps 50%, bridleway 25%

* Darken arrows for all paths and track

* Move path oneway arrows to right of line

Also check for oneway = -1 to make sure text and arrows are on the correct side of the path

Fix whitespace & simplify oneway arrow code for paths

* Change path oneway arrow to unicode text with halo

* Change path arrow to U+1f816 "Rightwards arrow with equilateral arrowhead"

* Add back missing "construction" in paths-text-name

This was unintentionally removed and would prevent the rendering of name labels for under-constructions paths

* Revert text-dy changes for oneway

Simplify current PR by removing the changes to text-dy for path name labels, which had been intended to make sure that the text was always on the same side as the arrows if these were rendered next to the line
  • Loading branch information
jeisenbe authored and matthijsmelissen committed Feb 12, 2019
1 parent 4df96c4 commit 9d3e0de
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 20 deletions.
14 changes: 12 additions & 2 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,7 @@ Layer:
properties:
minzoom: 13
- id: paths-text-name
class: directions
geometry: linestring
<<: *extents
Datasource:
Expand All @@ -2005,10 +2006,19 @@ Layer:
way,
highway,
construction,
name
name,
CASE
WHEN oneway IN ('yes', '-1') THEN oneway
WHEN junction IN ('roundabout') AND (oneway IS NULL OR NOT oneway IN ('no', 'reversible')) THEN 'yes'
ELSE NULL
END AS oneway,
horse,
bicycle
FROM planet_osm_line
WHERE highway IN ('bridleway', 'footway', 'cycleway', 'path', 'track', 'steps', 'construction')
AND name IS NOT NULL
AND (name IS NOT NULL
OR oneway IN ('yes', '-1')
OR junction IN ('roundabout'))
) AS paths_text_name
properties:
minzoom: 15
Expand Down
59 changes: 41 additions & 18 deletions roads.mss
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@
@footway-oneway-arrow-color: darken(@footway-fill, 35%);
@steps-oneway-arrow-color: darken(@steps-fill, 35%);
@cycleway-oneway-arrow-color: darken(@cycleway-fill, 25%);
@track-oneway-arrow-color: darken(@track-fill, 15%);
@bridleway-oneway-arrow-color: darken(@track-fill, 10%);
@track-oneway-arrow-color: darken(@track-fill, 10%);
@bridleway-oneway-arrow-color: darken(@bridleway-fill, 15%);

// Shield’s line wrap is based on OpenStreetMap data and not on line-wrap-width,
// but lines are typically rather short, so we use narrow line spacing.
Expand Down Expand Up @@ -3355,19 +3355,12 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[highway = 'road'],
[highway = 'service'],
[highway = 'pedestrian'],
[highway = 'raceway'],
[highway = 'cycleway'],
[highway = 'footway'],
[highway = 'path'],
[highway = 'steps'],
[highway = 'track'],
[highway = 'bridleway'] {
[highway = 'raceway'] {
[oneway = 'yes'],
[oneway = '-1'] {
marker-placement: line;
marker-spacing: 180;
marker-max-error: 0.5;

marker-file: url('symbols/oneway.svg');
[oneway = '-1'] {
marker-file: url('symbols/oneway-reverse.svg');
Expand Down Expand Up @@ -3408,32 +3401,62 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[highway = 'raceway'] {
marker-fill: @raceway-oneway-arrow-color;
}
[highway = 'footway'],
}
}

[highway = 'steps'],
[highway = 'cycleway'],
[highway = 'footway'],
[highway = 'path'],
[highway = 'track'],
[highway = 'bridleway'] {
[oneway = 'yes'],
[oneway = '-1'] {
text-name: "'🠖'";
text-size: 15;
text-clip: false;
text-spacing: 180;
text-placement: line;
text-halo-fill: @standard-halo-fill;
text-halo-radius: 1.5;
text-margin: 2;
text-dy: 3;
text-upright: right;
text-vertical-alignment: middle;
text-face-name: @book-fonts;
[oneway = '-1'] {
text-upright: left;
text-dy: -3;
}
[highway = 'footway'] {
text-fill: @footway-oneway-arrow-color;
}
[highway = 'path'] {
marker-fill: @footway-oneway-arrow-color;
text-fill: @footway-oneway-arrow-color;
[horse = 'designated'] {
marker-fill: @bridleway-oneway-arrow-color;
text-fill: @bridleway-oneway-arrow-color;
}
[bicycle = 'designated'] {
marker-fill: @cycleway-oneway-arrow-color;
text-fill: @cycleway-oneway-arrow-color;
}
}
[highway = 'steps'] {
marker-fill: @steps-oneway-arrow-color;
text-fill: @steps-oneway-arrow-color;
}
[highway = 'cycleway'] {
marker-fill: @cycleway-oneway-arrow-color;
text-fill: @cycleway-oneway-arrow-color;
}
[highway = 'track'] {
marker-fill: @track-oneway-arrow-color;
text-fill: @track-oneway-arrow-color;
}
[highway = 'bridleway'] {
marker-fill: @bridleway-oneway-arrow-color;
text-fill: @bridleway-oneway-arrow-color;
}
}
}
}
}

#railways-text-name {
/* Mostly started from z17. */
[railway = 'rail'],
Expand Down

0 comments on commit 9d3e0de

Please sign in to comment.