Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limit oneway arrows to currently supported highway features #972

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions src/layer/oneway.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,34 @@

// Common expressions
const highwaySelector = ["match", ["get", "class"]];
const baseFilter = [
"all",
["==", ["get", "oneway"], 1],
["!=", ["get", "ramp"], 1],
[
"in",
["get", "class"],
[
"literal",
[
"motorway",
"trunk",
"primary",
"secondary",
"tertiary",
"busway",
"minor",
"service",
],
],
],
];

export const surface = {
id: "oneway_surface",
filter: [
"all",
["==", ["get", "oneway"], 1],
["!=", ["get", "ramp"], 1],
...baseFilter,
["!", ["in", ["get", "brunnel"], ["literal", ["bridge", "tunnel"]]]],
["!", ["in", ["get", "class"], ["literal", ["path", "track"]]]],
],
source: "openmaptiles",
"source-layer": "transportation",
Expand Down Expand Up @@ -69,13 +88,7 @@ export const surface = {
export const tunnel = {
...surface,
id: "oneway_tunnel",
filter: [
"all",
["==", ["get", "oneway"], 1],
["!=", ["get", "ramp"], 1],
["==", ["get", "brunnel"], "tunnel"],
["!", ["in", ["get", "class"], ["literal", ["path", "track"]]]],
],
filter: [...baseFilter, ["==", ["get", "brunnel"], "tunnel"]],
paint: {
"icon-opacity": 0.2,
},
Expand All @@ -84,11 +97,5 @@ export const tunnel = {
export const bridge = {
...surface,
id: "oneway_bridge",
filter: [
"all",
["==", ["get", "oneway"], 1],
["!=", ["get", "ramp"], 1],
["==", ["get", "brunnel"], "bridge"],
["!", ["in", ["get", "class"], ["literal", ["path", "track"]]]],
],
filter: [...baseFilter, ["==", ["get", "brunnel"], "bridge"]],
};
Loading