From 47174ebaff146f215a466e6a5f749abe1f17e741 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Thu, 19 Jan 2023 23:43:24 -0500 Subject: [PATCH 01/12] Add initial support for tracks as double-track dashed lines. --- scripts/taginfo_template.json | 7 ++++++ src/js/legend_config.js | 2 ++ src/layer/index.js | 3 +++ src/layer/track.js | 46 +++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 src/layer/track.js diff --git a/scripts/taginfo_template.json b/scripts/taginfo_template.json index 67da7cfa6..c14f61512 100644 --- a/scripts/taginfo_template.json +++ b/scripts/taginfo_template.json @@ -222,6 +222,13 @@ "description": "Major roads under construction have a dotted line pattern and a more prominent color.", "doc_url": "https://openmaptiles.org/schema/#transportation" }, + { + "key": "highway", + "value": "track", + "object_types": ["way"], + "description": "Track roads have a two-track dashed line pattern.", + "doc_url": "https://openmaptiles.org/schema/#transportation" + }, { "key": "railway", "value": "rail", diff --git a/src/js/legend_config.js b/src/js/legend_config.js index 02e9170e3..80ce22c06 100644 --- a/src/js/legend_config.js +++ b/src/js/legend_config.js @@ -4,6 +4,7 @@ import * as PlaceLayers from "../layer/place.js"; import * as LanduseLayers from "../layer/landuse.js"; import * as BoundaryLayers from "../layer/boundary.js"; import * as RoadLayers from "../layer/road.js"; +import * as TrackLayers from "../layer/track.js"; import * as ConstructionLayers from "../layer/construction.js"; import * as HighwayExitLayers from "../layer/highway_exit.js"; import * as RailLayers from "../layer/rail.js"; @@ -27,6 +28,7 @@ export const sections = [ name: "Roads", entries: [ ...RoadLayers.legendEntries, + ...TrackLayers.legendEntries, ...ConstructionLayers.legendEntries, ...HighwayExitLayers.legendEntries, ], diff --git a/src/layer/index.js b/src/layer/index.js index 18d13e407..07df0c21e 100644 --- a/src/layer/index.js +++ b/src/layer/index.js @@ -14,6 +14,7 @@ import * as lyrPlace from "./place.js"; import * as lyrPoi from "./poi.js"; import * as lyrRail from "./rail.js"; import * as lyrRoad from "./road.js"; +import * as lyrTrack from "./track.js"; import * as lyrTransportationLabel from "./transportation_label.js"; import * as lyrWater from "./water.js"; import * as lyrBuilding from "./building.js"; @@ -86,6 +87,8 @@ export function build(locales) { lyrAeroway.taxiway, lyrAeroway.taxiwayArea, + lyrTrack.track, + lyrRoad.motorwayLink.casing(), lyrRoad.trunkLink.casing(), diff --git a/src/layer/track.js b/src/layer/track.js new file mode 100644 index 000000000..da5d04dc2 --- /dev/null +++ b/src/layer/track.js @@ -0,0 +1,46 @@ +"use strict"; + +import * as Color from "../constants/color.js"; + +const trackSelect = ["match", ["get", "class"], ["track"]]; + +export const track = { + id: "highway-track", + type: "line", + source: "openmaptiles", + "source-layer": "transportation", + filter: ["in", ["get", "class"], ["literal", ["track"]]], + minzoom: 9, + paint: { + "line-color": "tan", + "line-opacity": [ + "interpolate", + ["exponential", 1.2], + ["zoom"], + 13, + 0, + 15, + 1, + ], + "line-blur": 0.75, + "line-width": 0.5, + "line-dasharray": [7, 5], + "line-offset": 0, + "line-gap-width": [ + "interpolate", + ["exponential", 1.2], + ["zoom"], + 13, + 1.5, + 20, + 4, + ], + }, +}; + +export const legendEntries = [ + { + description: "Land access track", + layers: [track.id], + }, +]; From cab046c5c7410b101069b96d30b2f1d36307dae6 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Fri, 20 Jan 2023 00:11:47 -0500 Subject: [PATCH 02/12] Change min-zoom for tracks to reflect earliest entry into OMT. Unfortunately this means that most tracks snap in at full opacity, but there doesn't seem to be a way to avoid that without route_rank being exposed in OMT. --- src/layer/track.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layer/track.js b/src/layer/track.js index da5d04dc2..25098f14d 100644 --- a/src/layer/track.js +++ b/src/layer/track.js @@ -10,16 +10,16 @@ export const track = { source: "openmaptiles", "source-layer": "transportation", filter: ["in", ["get", "class"], ["literal", ["track"]]], - minzoom: 9, + minzoom: 12, paint: { "line-color": "tan", "line-opacity": [ "interpolate", ["exponential", 1.2], ["zoom"], - 13, + 12, 0, - 15, + 13, 1, ], "line-blur": 0.75, From 3cde280350bcfbf9fb3d49eaa392bd7b54063419 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Mon, 23 Jan 2023 20:04:51 -0500 Subject: [PATCH 03/12] Extend dashes to better match US FS topo style. Required lightening the color to avoid increasing the visual weight. --- src/layer/track.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layer/track.js b/src/layer/track.js index 25098f14d..a5acfcb65 100644 --- a/src/layer/track.js +++ b/src/layer/track.js @@ -12,7 +12,7 @@ export const track = { filter: ["in", ["get", "class"], ["literal", ["track"]]], minzoom: 12, paint: { - "line-color": "tan", + "line-color": "#d4b791", "line-opacity": [ "interpolate", ["exponential", 1.2], @@ -24,7 +24,7 @@ export const track = { ], "line-blur": 0.75, "line-width": 0.5, - "line-dasharray": [7, 5], + "line-dasharray": [12, 3], "line-offset": 0, "line-gap-width": [ "interpolate", From 4e9849355b4769b4bf22ddd3cc52108646bbd3d0 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Mon, 23 Jan 2023 20:45:41 -0500 Subject: [PATCH 04/12] Add solid double-track rendering for paved tracks. --- scripts/taginfo_template.json | 2 +- src/layer/index.js | 1 + src/layer/track.js | 21 +++++++++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/scripts/taginfo_template.json b/scripts/taginfo_template.json index c14f61512..94f92e0d3 100644 --- a/scripts/taginfo_template.json +++ b/scripts/taginfo_template.json @@ -226,7 +226,7 @@ "key": "highway", "value": "track", "object_types": ["way"], - "description": "Track roads have a two-track dashed line pattern.", + "description": "Track roads have a two-track line pattern that is dashed if unpaved and solid if paved.", "doc_url": "https://openmaptiles.org/schema/#transportation" }, { diff --git a/src/layer/index.js b/src/layer/index.js index 07df0c21e..e56f71161 100644 --- a/src/layer/index.js +++ b/src/layer/index.js @@ -88,6 +88,7 @@ export function build(locales) { lyrAeroway.taxiwayArea, lyrTrack.track, + lyrTrack.pavedTrack, lyrRoad.motorwayLink.casing(), lyrRoad.trunkLink.casing(), diff --git a/src/layer/track.js b/src/layer/track.js index a5acfcb65..fd13a452d 100644 --- a/src/layer/track.js +++ b/src/layer/track.js @@ -2,14 +2,16 @@ import * as Color from "../constants/color.js"; -const trackSelect = ["match", ["get", "class"], ["track"]]; +const trackSelect = ["==", ["get", "class"], "track"]; +const unpavedSelect = ["!=", ["get", "surface"], "paved"]; +const pavedSelect = ["==", ["get", "surface"], "paved"]; export const track = { id: "highway-track", type: "line", source: "openmaptiles", "source-layer": "transportation", - filter: ["in", ["get", "class"], ["literal", ["track"]]], + filter: ["all", trackSelect, unpavedSelect], minzoom: 12, paint: { "line-color": "#d4b791", @@ -38,9 +40,24 @@ export const track = { }, }; +export const pavedTrack = { + id: "highway-track-paved", + type: "line", + source: "openmaptiles", + "source-layer": "transportation", + filter: ["all", trackSelect, pavedSelect], + minzoom: 12, + paint: { ...track.paint }, +}; +pavedTrack["paint"]["line-dasharray"] = [1, 0]; + export const legendEntries = [ { description: "Land access track", layers: [track.id], }, + { + description: "Paved land access track", + layers: [pavedTrack.id], + }, ]; From 3d8a28bcab175373188afb4530ac999d85504b52 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Mon, 23 Jan 2023 21:03:55 -0500 Subject: [PATCH 05/12] Add track names to the transportation-labels layer. --- src/layer/transportation_label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layer/transportation_label.js b/src/layer/transportation_label.js index e3f45f4a1..9556ce783 100644 --- a/src/layer/transportation_label.js +++ b/src/layer/transportation_label.js @@ -8,7 +8,7 @@ const highwaySelector = ["match", ["get", "class"]]; const motorwayToTrunk = ["motorway", "trunk"]; const motorwayToPrimary = [...motorwayToTrunk, "primary"]; const motorwayToSecondary = [...motorwayToPrimary, "secondary"]; -const motorwayToMinor = [...motorwayToSecondary, "tertiary", "minor"]; +const motorwayToMinor = [...motorwayToSecondary, "tertiary", "minor", "track"]; const motorwayToService = [...motorwayToMinor, "service"]; const majorConstruction = ["motorway_construction", "trunk_construction"]; From dbc67005d56387c58badab224b33aa81cb1c1a92 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Wed, 1 Feb 2023 13:28:12 -0500 Subject: [PATCH 06/12] Tweak track widths to better match minor road widths at all zooms. --- src/layer/track.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layer/track.js b/src/layer/track.js index fd13a452d..f3297742a 100644 --- a/src/layer/track.js +++ b/src/layer/track.js @@ -33,9 +33,9 @@ export const track = { ["exponential", 1.2], ["zoom"], 13, - 1.5, + 0.7, 20, - 4, + 6, ], }, }; From c5895ae325884e2f92df7e15875ef5a69536541d Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Fri, 3 Feb 2023 17:48:19 -0500 Subject: [PATCH 07/12] Add basic bridge support. --- src/layer/index.js | 6 ++++ src/layer/track.js | 87 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 84 insertions(+), 9 deletions(-) diff --git a/src/layer/index.js b/src/layer/index.js index 9f5e35393..73b01f45a 100644 --- a/src/layer/index.js +++ b/src/layer/index.js @@ -147,6 +147,9 @@ export function build(locales) { var bridgeLayers = [ lyrRail.bridgeCasing, + lyrTrack.bridgeCasing, + lyrTrack.bridgeFill, + lyrRoad.trunkLinkBridge.casing(), lyrRoad.motorwayLinkBridge.casing(), @@ -182,6 +185,9 @@ export function build(locales) { lyrRoad.roadBridge.surface(), + lyrTrack.trackBridge, + lyrTrack.pavedTrackBridge, + lyrRail.railBridge.dashes(), lyrRail.railServiceBridge.dashes(), diff --git a/src/layer/track.js b/src/layer/track.js index f3297742a..ef3e5810d 100644 --- a/src/layer/track.js +++ b/src/layer/track.js @@ -5,6 +5,8 @@ import * as Color from "../constants/color.js"; const trackSelect = ["==", ["get", "class"], "track"]; const unpavedSelect = ["!=", ["get", "surface"], "paved"]; const pavedSelect = ["==", ["get", "surface"], "paved"]; +const bridgeSelect = ["==", ["get", "brunnel"], "bridge"]; +const opacity = ["interpolate", ["exponential", 1.2], ["zoom"], 12, 0, 13, 1]; export const track = { id: "highway-track", @@ -15,15 +17,7 @@ export const track = { minzoom: 12, paint: { "line-color": "#d4b791", - "line-opacity": [ - "interpolate", - ["exponential", 1.2], - ["zoom"], - 12, - 0, - 13, - 1, - ], + "line-opacity": opacity, "line-blur": 0.75, "line-width": 0.5, "line-dasharray": [12, 3], @@ -51,6 +45,81 @@ export const pavedTrack = { }; pavedTrack["paint"]["line-dasharray"] = [1, 0]; +export const trackBridge = { + id: "highway-track-bridge", + type: "line", + source: "openmaptiles", + "source-layer": "transportation", + filter: ["all", trackSelect, unpavedSelect, bridgeSelect], + minzoom: 12, + paint: { ...track.paint }, +}; + +export const pavedTrackBridge = { + id: "highway-track-paved-bridge", + type: "line", + source: "openmaptiles", + "source-layer": "transportation", + filter: ["all", trackSelect, pavedSelect, bridgeSelect], + minzoom: 12, + paint: { ...pavedTrack.paint }, +}; + +// Bridge casing layers +export const bridgeCasing = { + id: "track-bridge-casing", + type: "line", + source: "openmaptiles", + "source-layer": "transportation", + filter: ["all", bridgeSelect, trackSelect], + minzoom: 13, + layout: { + "line-cap": "butt", + "line-join": "bevel", + visibility: "visible", + }, + paint: { + "line-color": "black", + "line-opacity": opacity, + "line-width": [ + "interpolate", + ["exponential", 1.2], + ["zoom"], + 13, + 1.1, + 20, + 11, + ], + }, +}; +// Bridge casing layers +export const bridgeFill = { + id: "track-bridge-fill", + type: "line", + source: "openmaptiles", + "source-layer": "transportation", + filter: ["all", bridgeSelect, trackSelect], + minzoom: 13, + layout: { + "line-cap": "butt", + "line-join": "bevel", + visibility: "visible", + }, + paint: { + "line-color": Color.backgroundFill, + "line-opacity": opacity, + "line-width": [ + "interpolate", + ["exponential", 1.2], + ["zoom"], + 13, + 1.0, + 20, + 10, + ], + }, +}; + export const legendEntries = [ { description: "Land access track", From abe2c7c0eb97727274083090f08583d83a30be20 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Mon, 6 Feb 2023 20:48:39 -0500 Subject: [PATCH 08/12] Make fords water-line colored. --- src/layer/track.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/layer/track.js b/src/layer/track.js index ef3e5810d..58a971e2f 100644 --- a/src/layer/track.js +++ b/src/layer/track.js @@ -6,7 +6,10 @@ const trackSelect = ["==", ["get", "class"], "track"]; const unpavedSelect = ["!=", ["get", "surface"], "paved"]; const pavedSelect = ["==", ["get", "surface"], "paved"]; const bridgeSelect = ["==", ["get", "brunnel"], "bridge"]; +const fordSelect = ["==", ["get", "brunnel"], "ford"]; +const notFordSelect = ["!=", ["get", "brunnel"], "ford"]; const opacity = ["interpolate", ["exponential", 1.2], ["zoom"], 12, 0, 13, 1]; +const getBrunnel = ["get", "brunnel"]; export const track = { id: "highway-track", @@ -16,7 +19,13 @@ export const track = { filter: ["all", trackSelect, unpavedSelect], minzoom: 12, paint: { - "line-color": "#d4b791", + "line-color": [ + "match", + getBrunnel, + "ford", + Color.waterLine, + "#d4b791", + ], "line-opacity": opacity, "line-blur": 0.75, "line-width": 0.5, @@ -124,9 +133,21 @@ export const legendEntries = [ { description: "Land access track", layers: [track.id], + filter: notFordSelect, + }, + { + description: "Land access track - ford", + layers: [track.id], + filter: fordSelect, }, { description: "Paved land access track", layers: [pavedTrack.id], + filter: notFordSelect, + }, + { + description: "Paved land access track - ford", + layers: [pavedTrack.id], + filter: fordSelect, }, ]; From 530ac4ccc880a2ba032021d27a79f0fa5c9246b6 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Mon, 6 Feb 2023 20:51:12 -0500 Subject: [PATCH 09/12] Prettier coding style fixes. --- src/layer/track.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/layer/track.js b/src/layer/track.js index 58a971e2f..b92a17a61 100644 --- a/src/layer/track.js +++ b/src/layer/track.js @@ -19,13 +19,7 @@ export const track = { filter: ["all", trackSelect, unpavedSelect], minzoom: 12, paint: { - "line-color": [ - "match", - getBrunnel, - "ford", - Color.waterLine, - "#d4b791", - ], + "line-color": ["match", getBrunnel, "ford", Color.waterLine, "#d4b791"], "line-opacity": opacity, "line-blur": 0.75, "line-width": 0.5, From ab1e13351f889df77ab0f6cbf73533e866c987f8 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Tue, 7 Feb 2023 10:09:01 -0500 Subject: [PATCH 10/12] Add taginfo for ford and track surface. --- scripts/taginfo_template.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/taginfo_template.json b/scripts/taginfo_template.json index 94f92e0d3..e3fca4349 100644 --- a/scripts/taginfo_template.json +++ b/scripts/taginfo_template.json @@ -104,6 +104,13 @@ "description": "Unpaved roads have an alternating dash pattern.", "doc_url": "https://openmaptiles.org/schema/#surface" }, + { + "key": "surface", + "value": "track", + "object_types": ["way"], + "description": "Track roads have a two-track line pattern that is dashed if unpaved and solid if paved.", + "doc_url": "https://openmaptiles.org/schema/#transportation" + }, { "key": "iata", "object_types": ["node", "area"], @@ -229,6 +236,13 @@ "description": "Track roads have a two-track line pattern that is dashed if unpaved and solid if paved.", "doc_url": "https://openmaptiles.org/schema/#transportation" }, + { + "key": "ford", + "value": "yes", + "object_types": ["way"], + "description": "The color of track roads changes from brown to blue for ways tagged as fords.", + "doc_url": "https://openmaptiles.org/schema/#transportation" + }, { "key": "railway", "value": "rail", From 15a832e9bbcd07bed5e8ff146533cd128eb77ce1 Mon Sep 17 00:00:00 2001 From: Adam Franco Date: Tue, 7 Feb 2023 10:38:50 -0500 Subject: [PATCH 11/12] Shorten legend names. --- src/layer/track.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layer/track.js b/src/layer/track.js index b92a17a61..f536a11d8 100644 --- a/src/layer/track.js +++ b/src/layer/track.js @@ -125,22 +125,22 @@ export const bridgeFill = { export const legendEntries = [ { - description: "Land access track", + description: "Unpaved track", layers: [track.id], filter: notFordSelect, }, { - description: "Land access track - ford", + description: "Unpaved track - ford", layers: [track.id], filter: fordSelect, }, { - description: "Paved land access track", + description: "Paved track", layers: [pavedTrack.id], filter: notFordSelect, }, { - description: "Paved land access track - ford", + description: "Paved track - ford", layers: [pavedTrack.id], filter: fordSelect, }, From 5b3ba34c903f9ce87ba2959d61b55cc1b21c6000 Mon Sep 17 00:00:00 2001 From: William Misener <58491489+wmisener@users.noreply.github.com> Date: Sat, 23 Nov 2024 22:16:46 -0500 Subject: [PATCH 12/12] Update transportation_label.js To satisfy code_format --- src/layer/transportation_label.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/layer/transportation_label.js b/src/layer/transportation_label.js index 17cfdf180..b1fd394b6 100644 --- a/src/layer/transportation_label.js +++ b/src/layer/transportation_label.js @@ -8,7 +8,13 @@ const classSelector = ["match", ["get", "class"]]; const motorwayToTrunk = ["motorway", "trunk"]; const motorwayToPrimary = [...motorwayToTrunk, "primary"]; const motorwayToSecondary = [...motorwayToPrimary, "secondary"]; -const motorwayToMinor = [...motorwayToSecondary, "tertiary", "minor", "busway", "track"]; +const motorwayToMinor = [ + ...motorwayToSecondary, + "tertiary", + "minor", + "busway", + "track", +]; const motorwayToService = [...motorwayToMinor, "service"]; const majorConstruction = ["motorway_construction", "trunk_construction"];