Skip to content

Commit

Permalink
feat: Add roller coaster rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
tjur0 committed Aug 28, 2022
1 parent a5814b0 commit 7177887
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openstreetmap-carto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ local roads_info = {
construction = {z = 400, roads = false},
platform = {z = 90, roads = false},
},
roller_coaster = {
track = {z = 300, roads = true},
},
aeroway = {
runway = {z = 60, roads = false},
taxiway = {z = 50, roads = false},
Expand Down
1 change: 1 addition & 0 deletions openstreetmap-carto.style
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ node,way railway text linear
node,way ref text linear
node,way religion text linear
way route text linear
way roller_coaster text linear
way service text linear
node,way shop text polygon
way surface text linear
Expand Down
33 changes: 33 additions & 0 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,23 @@ Layer:
) AS guideways
properties:
minzoom: 11
- id: roller-coaster
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
roller_coaster,
CASE WHEN (tunnel = 'yes' OR tunnel = 'building_passage' OR covered = 'yes') THEN 'yes' ELSE 'no' END AS tunnel,
name
FROM planet_osm_line l
ORDER BY
COALESCE(layer, 0) -- put top layered track first
) AS roller_coaster
properties:
minzoom: 11
- id: entrances
geometry: point
<<: *extents
Expand Down Expand Up @@ -1950,6 +1967,22 @@ Layer:
) AS railways_text_name
properties:
minzoom: 11
- id: roller-coaster-text-name
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
roller_coaster,
name
FROM planet_osm_line l
ORDER BY
COALESCE(layer, 0) -- put top layered track first
) AS roller_coaster_text_name
properties:
minzoom: 11
- id: roads-text-ref-minor
geometry: linestring
<<: *extents
Expand Down
65 changes: 65 additions & 0 deletions style/roads.mss
Original file line number Diff line number Diff line change
Expand Up @@ -3520,6 +3520,49 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}
}

#roller-coaster {
[roller_coaster = 'track'] {
[zoom >= 15] {
line-width: 2;
line-color: #707070;
line-join: round;
b/line-width: 1;
b/line-color: @road-fill;
b/line-dasharray: 0,0.2,1,0.2;
b/line-join: round;
}
[zoom >= 16] {
line-width: 3;
b/line-width: 1.5;
b/line-dasharray: 0,0.3,3,0.3;
}
[zoom >= 17] {
line-width: 4.5;
b/line-width: 2.25;
b/line-dasharray: 0,0.45,4.5,0.45;
}
[zoom >= 18] {
line-width: 6;
b/line-width: 3;
b/line-dasharray: 0,0.6,6,0.6;
}
[zoom >= 19] {
line-width: 7.5;
b/line-width: 3.75;
b/line-dasharray: 0,0.75,7.5,0.75;
}
[zoom >= 20] {
line-width: 10;
b/line-width: 5;
b/line-dasharray: 0,1,10,1;
}
[tunnel = 'yes'] {
line-color: lighten(#707070, 10%);
b/line-color: lighten(@road-fill, 5%);
}
}
}

#roads-text-ref-low-zoom[zoom < 13] {
[highway = 'motorway'][zoom >= 10],
[highway = 'trunk'][zoom >= 11],
Expand Down Expand Up @@ -4206,3 +4249,25 @@ tertiary is rendered from z10 and is not included in osm_planet_roads. */
}
}
}

#roller-coaster-text-name {
[roller_coaster = 'track'] {
[zoom >= 17] {
text-name: "[name]";
text-fill: #666666;
text-size: 10;
text-dy: 6;
text-spacing: 900;
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: @railway-text-repeat-distance;
}
[zoom >= 19] {
text-size: 11;
text-dy: 7;
}
}
}

0 comments on commit 7177887

Please sign in to comment.