Skip to content

Commit

Permalink
Create new layer for "ref" of minor roads and paths (#3709)
Browse files Browse the repository at this point in the history
* Move residential, unclassified and track "ref" to new layer later in project.mml

* Change residential/unclassified ref to same size as name at >z17: This makes the ref lables at z17 and up consistent between track roads, paths, residential and unclassified highways

* Change unclassified and residential text ref halo-radius to standard size

* Change unclassified and residential text ref to oblique (italic) font
  • Loading branch information
jeisenbe authored Aug 30, 2019
1 parent 8b8e392 commit 68144f5
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 26 deletions.
52 changes: 47 additions & 5 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1762,12 +1762,12 @@ Layer:
osm_id,
way,
COALESCE(
CASE WHEN highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'track') THEN highway ELSE NULL END,
CASE WHEN highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary') THEN highway ELSE NULL END,
CASE WHEN aeroway IN ('runway', 'taxiway') THEN aeroway ELSE NULL END
) AS highway,
string_to_array(ref, ';') AS refs
FROM planet_osm_line
WHERE (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'track') OR aeroway IN ('runway', 'taxiway'))
WHERE (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary') OR aeroway IN ('runway', 'taxiway'))
AND ref IS NOT NULL
) AS p) AS q
WHERE height <= 4 AND width <= 11
Expand All @@ -1778,9 +1778,6 @@ Layer:
WHEN highway = 'primary' THEN 36
WHEN highway = 'secondary' THEN 35
WHEN highway = 'tertiary' THEN 34
WHEN highway = 'unclassified' THEN 33
WHEN highway = 'residential' THEN 32
WHEN highway = 'track' THEN 30
WHEN highway = 'runway' THEN 6
WHEN highway = 'taxiway' THEN 5
ELSE NULL
Expand Down Expand Up @@ -1933,6 +1930,51 @@ Layer:
) AS railways_text_name
properties:
minzoom: 11
- id: roads-text-ref-minor
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
highway,
height,
width,
refs
FROM (
SELECT
osm_id,
way,
highway,
array_length(refs,1) AS height,
(SELECT MAX(char_length(ref)) FROM unnest(refs) AS u(ref)) AS width,
array_to_string(refs, E'\n') AS refs
FROM (
SELECT
osm_id,
way,
CASE WHEN highway IN ('unclassified', 'residential', 'track') THEN highway ELSE NULL END AS highway,
string_to_array(ref, ';') AS refs
FROM planet_osm_line
WHERE highway IN ('unclassified', 'residential', 'track')
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 = 'track' THEN 30
ELSE NULL
END DESC NULLS LAST,
height DESC,
width DESC,
refs,
osm_id
) AS roads_text_ref_minor
properties:
minzoom: 15
- id: text-poly-low-zoom
class: text-low-zoom
geometry: polygon
Expand Down
43 changes: 22 additions & 21 deletions roads.mss
Original file line number Diff line number Diff line change
Expand Up @@ -3040,7 +3040,24 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}
}
}
[highway = 'runway'],
[highway = 'taxiway'] {
[zoom >= 15] {
text-name: "[refs]";
text-size: 10;
text-fill: #333;
text-spacing: 750;
text-clip: false;
text-placement: line;
text-face-name: @oblique-fonts;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-repeat-distance: @minor-highway-text-repeat-distance;
}
}
}

#roads-text-ref-minor {
[highway = 'unclassified'],
[highway = 'residential'] {
[zoom >= 15] {
Expand All @@ -3050,15 +3067,15 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
[zoom >= 16] {
text-size: 9;
}
[zoom >= 18] {
text-size: 10;
[zoom >= 17] {
text-size: 11;
}

text-fill: #000;
text-face-name: @book-fonts;
text-face-name: @oblique-fonts;
text-placement: line;
text-repeat-distance: @major-highway-text-repeat-distance;
text-halo-radius: 2;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-spacing: 760;
text-clip: false;
Expand All @@ -3082,7 +3099,7 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */

text-clip: false;
text-fill: #222;
text-face-name: @book-fonts;
text-face-name: @oblique-fonts;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-margin: 10;
Expand All @@ -3092,22 +3109,6 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
text-vertical-alignment: middle;
}
}

[highway = 'runway'],
[highway = 'taxiway'] {
[zoom >= 15] {
text-name: "[refs]";
text-size: 10;
text-fill: #333;
text-spacing: 750;
text-clip: false;
text-placement: line;
text-face-name: @book-fonts;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-repeat-distance: @minor-highway-text-repeat-distance;
}
}
}

#roads-text-name {
Expand Down

0 comments on commit 68144f5

Please sign in to comment.