Skip to content

Commit

Permalink
Merge pull request #972 from ZeLonewolf/clay-oneway-filter
Browse files Browse the repository at this point in the history
limit oneway arrows to currently supported highway features
  • Loading branch information
claysmalley authored Oct 24, 2023
2 parents e6e43ed + 68a97f3 commit 9be18eb
Showing 1 changed file with 25 additions and 18 deletions.
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"]],
};

0 comments on commit 9be18eb

Please sign in to comment.