Skip to content

Commit

Permalink
Merge pull request #512 from ZeLonewolf/clay-oneway
Browse files Browse the repository at this point in the history
Add oneway arrows to remaining highway classes
  • Loading branch information
claysmalley authored Jun 23, 2023
2 parents e3ebcf4 + ed31f12 commit 4a84f51
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 255 deletions.
6 changes: 0 additions & 6 deletions icons/oneway.svg

This file was deleted.

3 changes: 3 additions & 0 deletions icons/oneway_black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/oneway_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions src/layer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export function build(locales) {
lyrRoad.roadTunnel.fill(),

lyrOneway.tunnel,
lyrOneway.tunnelLink,

lyrFerry.ferry,

Expand Down Expand Up @@ -136,8 +135,7 @@ export function build(locales) {

lyrRail.railway.fill(),

lyrOneway.road,
lyrOneway.link,
lyrOneway.surface,

lyrAerialway.dragLift
);
Expand Down Expand Up @@ -197,7 +195,6 @@ export function build(locales) {
lyrRail.railwayBridge.fill(),

lyrOneway.bridge,
lyrOneway.bridgeLink,
];

layers.push(...lyrRail.getLayerSeparatedBridgeLayers(bridgeLayers));
Expand Down
296 changes: 51 additions & 245 deletions src/layer/oneway.js
Original file line number Diff line number Diff line change
@@ -1,285 +1,91 @@
"use strict";

export const road = {
id: "road_oneway",
type: "symbol",
paint: {
"icon-opacity": 0.5,
},
// Common expressions
const highwaySelector = ["match", ["get", "class"]];

export const surface = {
id: "oneway_surface",
filter: [
"all",
["==", ["get", "oneway"], 1],
["!", ["in", ["get", "brunnel"], ["literal", ["bridge", "tunnel"]]]],
["!=", ["get", "ramp"], 1],
[
"in",
["get", "class"],
[
"literal",
[
"motorway",
// "trunk",
// "primary",
// "secondary",
// "tertiary",
// "minor",
// "service",
],
],
],
["!", ["in", ["get", "brunnel"], ["literal", ["bridge", "tunnel"]]]],
],
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",
},
source: "openmaptiles",
minzoom: 15,
"source-layer": "transportation",
};

export const tunnel = {
id: "tunnel_oneway",
type: "symbol",
paint: {
"icon-opacity": 0.5,
},
filter: [
"all",
["==", ["get", "oneway"], 1],
["==", ["get", "brunnel"], "tunnel"],
["!=", ["get", "ramp"], 1],
[
"in",
["get", "class"],
[
"literal",
[
"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",
["==", ["get", "oneway"], 1],
["==", ["get", "brunnel"], "bridge"],
["!=", ["get", "ramp"], 1],
[
"in",
["get", "class"],
layout: {
"icon-size": [
"interpolate",
["exponential", 1.2],
["zoom"],
15,
[...highwaySelector, ["motorway", "trunk", "primary"], 0.5, 0.3],
19,
[
"literal",
[
"motorway",
// "trunk",
// "primary",
// "secondary",
// "tertiary",
// "minor",
// "service",
],
...highwaySelector,
["motorway", "trunk", "primary"],
1,
"secondary",
0.8,
0.6,
],
],
],
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",
},
source: "openmaptiles",
minzoom: 15,
"source-layer": "transportation",
};

export const link = {
id: "road_oneway_link",
type: "symbol",
paint: {
"icon-opacity": 0.5,
},
filter: [
"all",
["==", ["get", "oneway"], 1],
["!", ["in", ["get", "brunnel"], ["literal", ["bridge", "tunnel"]]]],
["==", ["get", "ramp"], 1],
[
"in",
["get", "class"],
"icon-image": [
"match",
["get", "brunnel"],
"tunnel",
"oneway_black",
[
"literal",
[
"motorway",
// "trunk",
// "primary",
// "secondary",
// "tertiary",
// "minor",
// "service",
],
"match",
["get", "toll"],
1,
"oneway_black",
[...highwaySelector, "motorway", "oneway_white", "oneway_black"],
],
],
],
layout: {
"icon-size": {
stops: [
[15, 0.3],
[19, 0.8],
],
},
"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",
},
source: "openmaptiles",
minzoom: 16,
"source-layer": "transportation",
};

export const tunnelLink = {
id: "tunnel_oneway_link",
type: "symbol",
paint: {
"icon-opacity": 0.5,
},
};

export const tunnel = {
...surface,
id: "oneway_tunnel",
filter: [
"all",
["==", ["get", "oneway"], 1],
["!=", ["get", "ramp"], 1],
["==", ["get", "brunnel"], "tunnel"],
["==", ["get", "ramp"], 1],
[
"in",
["get", "class"],
[
"literal",
[
"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",
paint: {
"icon-opacity": 0.2,
},
source: "openmaptiles",
minzoom: 16,
"source-layer": "transportation",
};

export const bridgeLink = {
id: "bridge_oneway_link",
type: "symbol",
paint: {
"icon-opacity": 0.5,
},
export const bridge = {
...surface,
id: "oneway_bridge",
filter: [
"all",
["==", ["get", "oneway"], 1],
["!=", ["get", "ramp"], 1],
["==", ["get", "brunnel"], "bridge"],
["==", ["get", "ramp"], 1],
[
"in",
["get", "class"],
[
"literal",
[
"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",
};
1 change: 1 addition & 0 deletions src/layer/transportation_label.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const bridgeSpacer = {
"all",
["==", ["get", "brunnel"], "bridge"],
["in", ["geometry-type"], ["literal", ["LineString"]]],
["!=", ["get", "oneway"], 1],
],
paint: {
"icon-opacity": 0,
Expand Down

0 comments on commit 4a84f51

Please sign in to comment.