Skip to content

Commit 63302aa

Browse files
committed
Don't attempt to split nulls
1 parent ad71976 commit 63302aa

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

js/styleGenerator.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const filters = {
7878
is_foot_route: [
7979
"all",
8080
["has", "highway"],
81+
["has", "r.route"],
8182
[
8283
"any",
8384
["in", "hiking", ["split", ["get", "r.route"], "┃"]],
@@ -446,7 +447,7 @@ const lineLayer = {
446447
[
447448
"any",
448449
[">=", ["zoom"], 12],
449-
["in", "road", ["split", ["get", "r.route"], "┃"]]
450+
["in", "road", ["split", ["coalesce", ["get", "r.route"], ""], "┃"]]
450451
]
451452
],
452453
filters.is_watercourse,
@@ -691,7 +692,7 @@ function getTagsExp(tags) {
691692
if (value === '*') {
692693
exp.push(["has", key]);
693694
} else {
694-
exp.push(["in", value, ["split", ["get", key], ";"]]);
695+
exp.push(["in", value, ["split", ["coalesce", ["get", key], ""], ";"]]);
695696
}
696697
}
697698
if (exp.length === 1) {
@@ -709,7 +710,7 @@ function getRTagsExp(tags) {
709710
if (value === '*') {
710711
exp.push(["has", `r.${key}`]);
711712
} else {
712-
exp.push(["in", `${value}`, ["split", ["get", `r.${key}`], "┃"]]);
713+
exp.push(["in", `${value}`, ["split", ["coalesce", ["get", `r.${key}`], ""], "┃"]]);
713714
}
714715
}
715716
if (exp.length === 1) {
@@ -1217,6 +1218,8 @@ export async function generateStyle(baseStyleJson, opts) {
12171218
"type": "line",
12181219
"filter": [
12191220
"all",
1221+
["has", "r.boundary"],
1222+
["has", "r.admin_level"],
12201223
["in", "administrative", ["split", ["get", "r.boundary"], "┃"]],
12211224
[
12221225
"any",
@@ -1249,6 +1252,8 @@ export async function generateStyle(baseStyleJson, opts) {
12491252
"type": "line",
12501253
"filter": [
12511254
"all",
1255+
["has", "r.boundary"],
1256+
["has", "r.admin_level"],
12521257
["in", "administrative", ["split", ["get", "r.boundary"], "┃"]],
12531258
[
12541259
"any",

0 commit comments

Comments
 (0)