From 7b1d9885c59884b7e7f5e5ee7836670eac1c14e5 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sun, 24 Jul 2022 19:38:10 -0400 Subject: [PATCH 01/12] Add oneway arrows to remaining highway classes --- src/americana.js | 5 +- src/layer/oneway.js | 294 ++++++++++---------------------------------- 2 files changed, 67 insertions(+), 232 deletions(-) diff --git a/src/americana.js b/src/americana.js index 890cee951..6a846b51a 100644 --- a/src/americana.js +++ b/src/americana.js @@ -125,7 +125,6 @@ americanaLayers.push( lyrRoad.smallServiceTollTunnel.fill(), lyrOneway.tunnel, - lyrOneway.tunnelLink, lyrAeroway.runway, lyrAeroway.runwayArea, @@ -223,8 +222,7 @@ americanaLayers.push( lyrRoad.secondaryToll.surface(), lyrRoad.primaryToll.surface(), - lyrOneway.road, - lyrOneway.link + lyrOneway.surface ); americanaLayers.push(lyrBuilding.building); @@ -314,7 +312,6 @@ var bridgeLayers = [ lyrRoadLabel.bridgeSpacer, lyrOneway.bridge, - lyrOneway.bridgeLink, ]; //Render bridge without layer on the lowest bridge layer diff --git a/src/layer/oneway.js b/src/layer/oneway.js index ed1b598f0..85d16a339 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -1,120 +1,70 @@ "use strict"; -export const road = { - id: "road_oneway", - type: "symbol", - paint: { - "icon-opacity": 0.5, - }, - filter: [ - "all", - ["==", "oneway", 1], - ["!in", "brunnel", "bridge", "tunnel"], - ["!=", "ramp", 1], +// Common expressions +const highwaySelector = ["match", ["get", "class"]]; + +const linkSelector = ["match", ["get", "ramp"], 1]; + +// Helper function to determine icon opacity +function iconOpacity(maxOpacity) { + return [ + "interpolate", + ["exponential", 2], + ["zoom"], + 15, + 0, + 16, [ - "in", - "class", - "motorway", - // "trunk", - // "primary", - // "secondary", - // "tertiary", - // "minor", - // "service", + ...highwaySelector, + ["motorway", "trunk", "primary", "secondary", "tertiary"], + [...linkSelector, 0, maxOpacity], + 0, ], - ], - layout: { - "icon-size": { - stops: [ - [15, 0.5], - [19, 1], - ], - }, - "icon-image": "oneway", - visibility: "visible", - "icon-padding": 2, - "symbol-spacing": 75, - "symbol-placement": "line", - "icon-rotation-alignment": "map", - }, + 17, + maxOpacity, + ]; +} + +export const surface = { + id: "road_oneway", + filter: ["all", ["==", "oneway", 1], ["!in", "brunnel", "bridge", "tunnel"]], + source: "openmaptiles", - minzoom: 15, "source-layer": "transportation", -}; - -export const tunnel = { - id: "tunnel_oneway", type: "symbol", - paint: { - "icon-opacity": 0.5, - }, - filter: [ - "all", - ["==", "oneway", 1], - ["==", "brunnel", "tunnel"], - ["!=", "ramp", 1], - [ - "in", - "class", - "motorway", - // "trunk", - // "primary", - // "secondary", - // "tertiary", - // "minor", - // "service", - ], - ], - layout: { - "icon-size": { - stops: [ - [15, 0.5], - [19, 1], - ], - }, - "icon-image": "oneway", - visibility: "visible", - //"icon-rotate": 90, - "icon-padding": 2, - "symbol-spacing": 75, - "symbol-placement": "line", - "icon-rotation-alignment": "map", - }, - source: "openmaptiles", + minzoom: 15, - "source-layer": "transportation", -}; -export const bridge = { - id: "bridge_oneway", - type: "symbol", - paint: { - "icon-opacity": 0.5, - }, - filter: [ - "all", - ["==", "oneway", 1], - ["==", "brunnel", "bridge"], - ["!=", "ramp", 1], - [ - "in", - "class", - "motorway", - // "trunk", - // "primary", - // "secondary", - // "tertiary", - // "minor", - // "service", - ], - ], layout: { - "icon-size": { - stops: [ - [15, 0.5], - [19, 1], + "icon-size": [ + "interpolate", + ["exponential", 1.2], + ["zoom"], + 15, + [ + ...highwaySelector, + "motorway", + [...linkSelector, 0.3, 0.5], + ["trunk", "primary"], + [...linkSelector, 0.2, 0.5], + "secondary", + [...linkSelector, 0.2, 0.3], + 0.2, + ], + 19, + [ + ...highwaySelector, + "motorway", + [...linkSelector, 0.8, 1], + ["trunk", "primary"], + [...linkSelector, 0.6, 1], + "secondary", + [...linkSelector, 0.4, 0.8], + "tertiary", + [...linkSelector, 0.3, 0.6], + 0.3, ], - }, + ], "icon-image": "oneway", visibility: "visible", "icon-padding": 2, @@ -122,134 +72,22 @@ export const bridge = { "symbol-placement": "line", "icon-rotation-alignment": "map", }, - source: "openmaptiles", - minzoom: 15, - "source-layer": "transportation", -}; - -export const link = { - id: "road_oneway_link", - type: "symbol", paint: { - "icon-opacity": 0.5, - }, - filter: [ - "all", - ["==", "oneway", 1], - ["!in", "brunnel", "bridge", "tunnel"], - ["==", "ramp", 1], - [ - "in", - "class", - "motorway", - // "trunk", - // "primary", - // "secondary", - // "tertiary", - // "minor", - // "service", - ], - ], - layout: { - "icon-size": { - stops: [ - [15, 0.3], - [19, 0.8], - ], - }, - "icon-image": "oneway", - visibility: "visible", - "icon-padding": 2, - "symbol-spacing": 75, - "symbol-placement": "line", - "icon-rotation-alignment": "map", + "icon-opacity": iconOpacity(0.5), }, - source: "openmaptiles", - minzoom: 16, - "source-layer": "transportation", }; -export const tunnelLink = { - id: "tunnel_oneway_link", - type: "symbol", +export const tunnel = { + ...surface, + id: "tunnel_oneway", + filter: ["all", ["==", "oneway", 1], ["==", "brunnel", "tunnel"]], paint: { - "icon-opacity": 0.5, + "icon-opacity": iconOpacity(0.2), }, - filter: [ - "all", - ["==", "oneway", 1], - ["==", "brunnel", "tunnel"], - ["==", "ramp", 1], - [ - "in", - "class", - "motorway", - // "trunk", - // "primary", - // "secondary", - // "tertiary", - // "minor", - // "service", - ], - ], - layout: { - "icon-size": { - stops: [ - [15, 0.3], - [19, 0.8], - ], - }, - "icon-image": "oneway", - visibility: "visible", - //"icon-rotate": 90, - "icon-padding": 2, - "symbol-spacing": 75, - "symbol-placement": "line", - "icon-rotation-alignment": "map", - }, - source: "openmaptiles", - minzoom: 16, - "source-layer": "transportation", }; -export const bridgeLink = { - id: "bridge_oneway_link", - type: "symbol", - paint: { - "icon-opacity": 0.5, - }, - filter: [ - "all", - ["==", "oneway", 1], - ["==", "brunnel", "bridge"], - ["==", "ramp", 1], - [ - "in", - "class", - "motorway", - // "trunk", - // "primary", - // "secondary", - // "tertiary", - // "minor", - // "service", - ], - ], - layout: { - "icon-size": { - stops: [ - [15, 0.3], - [19, 0.8], - ], - }, - "icon-image": "oneway", - visibility: "visible", - "icon-padding": 2, - "symbol-spacing": 75, - "symbol-placement": "line", - "icon-rotation-alignment": "map", - }, - source: "openmaptiles", - minzoom: 16, - "source-layer": "transportation", +export const bridge = { + ...surface, + id: "bridge_oneway", + filter: ["all", ["==", "oneway", 1], ["==", "brunnel", "bridge"]], }; From 8e1a6ba807cc6dc5a21a724b26d20ad5c800177e Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sun, 24 Jul 2022 21:17:07 -0400 Subject: [PATCH 02/12] Adjust oneway arrow spacing --- src/layer/oneway.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/layer/oneway.js b/src/layer/oneway.js index 85d16a339..4e3d1fe2e 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -68,7 +68,15 @@ export const surface = { "icon-image": "oneway", visibility: "visible", "icon-padding": 2, - "symbol-spacing": 75, + "symbol-spacing": [ + "interpolate", + ["exponential", 1.2], + ["zoom"], + 15, + 75, + 19, + 300, + ], "symbol-placement": "line", "icon-rotation-alignment": "map", }, From af56c56dcf1192e9fca8e008e5bc2106ea643092 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sun, 24 Jul 2022 21:17:46 -0400 Subject: [PATCH 03/12] Add maxzoom for oneway arrows --- src/layer/oneway.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/layer/oneway.js b/src/layer/oneway.js index 4e3d1fe2e..0b85e731c 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -34,6 +34,7 @@ export const surface = { type: "symbol", minzoom: 15, + maxzoom: 20, // Removing this may affect performance layout: { "icon-size": [ From ee8f903f16bf3cbbb14bc37941bf8e6b1e3b9bcb Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sun, 24 Jul 2022 21:28:05 -0400 Subject: [PATCH 04/12] Remove icon opacity expression from oneway layer --- src/layer/oneway.js | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/layer/oneway.js b/src/layer/oneway.js index 0b85e731c..7efca9b6e 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -5,26 +5,6 @@ const highwaySelector = ["match", ["get", "class"]]; const linkSelector = ["match", ["get", "ramp"], 1]; -// Helper function to determine icon opacity -function iconOpacity(maxOpacity) { - return [ - "interpolate", - ["exponential", 2], - ["zoom"], - 15, - 0, - 16, - [ - ...highwaySelector, - ["motorway", "trunk", "primary", "secondary", "tertiary"], - [...linkSelector, 0, maxOpacity], - 0, - ], - 17, - maxOpacity, - ]; -} - export const surface = { id: "road_oneway", filter: ["all", ["==", "oneway", 1], ["!in", "brunnel", "bridge", "tunnel"]], @@ -82,7 +62,7 @@ export const surface = { "icon-rotation-alignment": "map", }, paint: { - "icon-opacity": iconOpacity(0.5), + "icon-opacity": 0.5, }, }; @@ -91,7 +71,7 @@ export const tunnel = { id: "tunnel_oneway", filter: ["all", ["==", "oneway", 1], ["==", "brunnel", "tunnel"]], paint: { - "icon-opacity": iconOpacity(0.2), + "icon-opacity": 0.2, }, }; From 20ea9e729d9006d84e85bacfc79b6ed5aedb7bab Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sun, 24 Jul 2022 22:40:44 -0400 Subject: [PATCH 05/12] Change motorway and trunk oneway arrow to white --- icons/{oneway.svg => oneway_black.svg} | 0 icons/oneway_white.svg | 6 ++++++ src/layer/oneway.js | 25 ++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) rename icons/{oneway.svg => oneway_black.svg} (100%) create mode 100644 icons/oneway_white.svg diff --git a/icons/oneway.svg b/icons/oneway_black.svg similarity index 100% rename from icons/oneway.svg rename to icons/oneway_black.svg diff --git a/icons/oneway_white.svg b/icons/oneway_white.svg new file mode 100644 index 000000000..eb01344b3 --- /dev/null +++ b/icons/oneway_white.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/layer/oneway.js b/src/layer/oneway.js index 7efca9b6e..367edb65d 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -46,7 +46,30 @@ export const surface = { 0.3, ], ], - "icon-image": "oneway", + "icon-image": [ + "match", + ["get", "brunnel"], + "tunnel", + "oneway_black", + [ + "match", + ["get", "toll"], + 1, + "oneway_black", + [ + "match", + ["get", "expressway"], + 1, + "oneway_black", + [ + ...highwaySelector, + ["motorway", "trunk"], + "oneway_white", + "oneway_black", + ], + ], + ], + ], visibility: "visible", "icon-padding": 2, "symbol-spacing": [ From ae9753fb60219685381141a99cca896d6e0ae071 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sun, 24 Jul 2022 22:46:05 -0400 Subject: [PATCH 06/12] Change trunk oneway arrow to black --- src/layer/oneway.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/layer/oneway.js b/src/layer/oneway.js index 367edb65d..262934e8a 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -56,18 +56,7 @@ export const surface = { ["get", "toll"], 1, "oneway_black", - [ - "match", - ["get", "expressway"], - 1, - "oneway_black", - [ - ...highwaySelector, - ["motorway", "trunk"], - "oneway_white", - "oneway_black", - ], - ], + [...highwaySelector, "motorway", "oneway_white", "oneway_black"], ], ], visibility: "visible", From c12dde1100a7c82a2a91702994285df5006803de Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Tue, 30 Aug 2022 20:49:38 -0400 Subject: [PATCH 07/12] Remove oneway arrows from link roads --- src/layer/oneway.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/layer/oneway.js b/src/layer/oneway.js index 1ad5a997a..62af02c86 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -2,13 +2,13 @@ // Common expressions const highwaySelector = ["match", ["get", "class"]]; -const linkSelector = ["match", ["get", "ramp"], 1]; export const surface = { id: "road_oneway", filter: [ "all", ["==", ["get", "oneway"], 1], + ["!=", ["get", "ramp"], 1], ["!", ["in", ["get", "brunnel"], ["literal", ["bridge", "tunnel"]]]], ], source: "openmaptiles", @@ -25,25 +25,21 @@ export const surface = { 15, [ ...highwaySelector, - "motorway", - [...linkSelector, 0.3, 0.5], - ["trunk", "primary"], - [...linkSelector, 0.2, 0.5], + ["motorway", "trunk", "primary"], + 0.5, "secondary", - [...linkSelector, 0.2, 0.3], + 0.3, 0.2, ], 19, [ ...highwaySelector, - "motorway", - [...linkSelector, 0.8, 1], - ["trunk", "primary"], - [...linkSelector, 0.6, 1], + ["motorway", "trunk", "primary"], + 1, "secondary", - [...linkSelector, 0.4, 0.8], + 0.8, "tertiary", - [...linkSelector, 0.3, 0.6], + 0.6, 0.3, ], ], @@ -85,6 +81,7 @@ export const tunnel = { filter: [ "all", ["==", ["get", "oneway"], 1], + ["!=", ["get", "ramp"], 1], ["==", ["get", "brunnel"], "tunnel"], ], paint: { @@ -98,6 +95,7 @@ export const bridge = { filter: [ "all", ["==", ["get", "oneway"], 1], + ["!=", ["get", "ramp"], 1], ["==", ["get", "brunnel"], "bridge"], ], }; From 2ed104fd2bc6a67c788cc06e02cea15e7e9c641d Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sat, 17 Jun 2023 15:16:14 -0400 Subject: [PATCH 08/12] tweak oneway arrow icons --- icons/oneway_black.svg | 7 ++----- icons/oneway_white.svg | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/icons/oneway_black.svg b/icons/oneway_black.svg index 476bf8103..4166e3786 100644 --- a/icons/oneway_black.svg +++ b/icons/oneway_black.svg @@ -1,6 +1,3 @@ - - - - - + + diff --git a/icons/oneway_white.svg b/icons/oneway_white.svg index eb01344b3..d1a95a084 100644 --- a/icons/oneway_white.svg +++ b/icons/oneway_white.svg @@ -1,6 +1,3 @@ - - - - - + + From a0190df17c11e6c884d88a6cfcb3d4e43b299aab Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Sat, 17 Jun 2023 15:33:43 -0400 Subject: [PATCH 09/12] fix oneway arrow size on busways --- src/layer/oneway.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layer/oneway.js b/src/layer/oneway.js index c36666533..95dcfb14b 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -37,7 +37,7 @@ export const surface = { 1, "secondary", 0.8, - "tertiary", + ["tertiary", "busway"], 0.6, 0.3, ], From a3ca13c63182ebd3a4a3b45e6a11b142900810d4 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Mon, 19 Jun 2023 15:19:26 -0400 Subject: [PATCH 10/12] adjust oneway arrow size --- src/layer/oneway.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/layer/oneway.js b/src/layer/oneway.js index 95dcfb14b..48c9acf73 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -22,14 +22,7 @@ export const surface = { ["exponential", 1.2], ["zoom"], 15, - [ - ...highwaySelector, - ["motorway", "trunk", "primary"], - 0.5, - "secondary", - 0.3, - 0.2, - ], + [...highwaySelector, ["motorway", "trunk", "primary"], 0.5, 0.3], 19, [ ...highwaySelector, @@ -39,7 +32,7 @@ export const surface = { 0.8, ["tertiary", "busway"], 0.6, - 0.3, + 0.4, ], ], "icon-image": [ From 3dcbeb78d18188f3bbb677f72928c5e2d398f538 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Mon, 19 Jun 2023 16:03:15 -0400 Subject: [PATCH 11/12] resize oneway arrow --- icons/oneway_black.svg | 4 ++-- icons/oneway_white.svg | 4 ++-- src/layer/oneway.js | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/icons/oneway_black.svg b/icons/oneway_black.svg index 4166e3786..825ab153d 100644 --- a/icons/oneway_black.svg +++ b/icons/oneway_black.svg @@ -1,3 +1,3 @@ - - + + diff --git a/icons/oneway_white.svg b/icons/oneway_white.svg index d1a95a084..70dc2aae4 100644 --- a/icons/oneway_white.svg +++ b/icons/oneway_white.svg @@ -1,3 +1,3 @@ - - + + diff --git a/src/layer/oneway.js b/src/layer/oneway.js index 48c9acf73..ffdba3004 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -30,9 +30,7 @@ export const surface = { 1, "secondary", 0.8, - ["tertiary", "busway"], 0.6, - 0.4, ], ], "icon-image": [ From 1b994fa2090230c86532b103f6f6f8bf992b1521 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Tue, 20 Jun 2023 12:20:39 -0400 Subject: [PATCH 12/12] remove bridge spacer label when oneway arrows are present --- src/layer/oneway.js | 6 +++--- src/layer/transportation_label.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/layer/oneway.js b/src/layer/oneway.js index ffdba3004..47253b9c6 100644 --- a/src/layer/oneway.js +++ b/src/layer/oneway.js @@ -4,7 +4,7 @@ const highwaySelector = ["match", ["get", "class"]]; export const surface = { - id: "road_oneway", + id: "oneway_surface", filter: [ "all", ["==", ["get", "oneway"], 1], @@ -67,7 +67,7 @@ export const surface = { export const tunnel = { ...surface, - id: "tunnel_oneway", + id: "oneway_tunnel", filter: [ "all", ["==", ["get", "oneway"], 1], @@ -81,7 +81,7 @@ export const tunnel = { export const bridge = { ...surface, - id: "bridge_oneway", + id: "oneway_bridge", filter: [ "all", ["==", ["get", "oneway"], 1], diff --git a/src/layer/transportation_label.js b/src/layer/transportation_label.js index 5ea963582..1da367753 100644 --- a/src/layer/transportation_label.js +++ b/src/layer/transportation_label.js @@ -176,6 +176,7 @@ export const bridgeSpacer = { "all", ["==", ["get", "brunnel"], "bridge"], ["in", ["geometry-type"], ["literal", ["LineString"]]], + ["!=", ["get", "oneway"], 1], ], paint: { "icon-opacity": 0,