From b8bf3cc714eb1ab371aeeb0c0e009cc7fc295925 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 7 Jul 2021 13:24:37 +0200 Subject: [PATCH 1/2] Only show nature reserves of Natuurpunt --- .../layers/nature_reserve/nature_reserve.json | 10 +++++++--- assets/themes/natuurpunt/natuurpunt.json | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/assets/layers/nature_reserve/nature_reserve.json b/assets/layers/nature_reserve/nature_reserve.json index a0fd58df80..11bd7c027c 100644 --- a/assets/layers/nature_reserve/nature_reserve.json +++ b/assets/layers/nature_reserve/nature_reserve.json @@ -6,9 +6,13 @@ "minzoom": 12, "source": { "osmTags": { - "or": [ - "leisure=nature_reserve", - "boundary=protected_area" + "and": [ + { + "or": [ + "leisure=nature_reserve", + "boundary=protected_area" + ] + } ] } }, diff --git a/assets/themes/natuurpunt/natuurpunt.json b/assets/themes/natuurpunt/natuurpunt.json index 4083ed5b80..b3e22b2dde 100644 --- a/assets/themes/natuurpunt/natuurpunt.json +++ b/assets/themes/natuurpunt/natuurpunt.json @@ -12,7 +12,10 @@ "nl": "Op deze kaart vind je alle natuurgebieden die Natuurpunt ter beschikking stelt", "en": "On this map you can find all the nature reserves that Natuurpunt offers " }, - "language": ["nl", "en"], + "language": [ + "nl", + "en" + ], "maintainer": "", "icon": "./assets/themes/natuurpunt/natuurpunt.png", "version": "0", @@ -22,7 +25,18 @@ "widenFactor": 0.05, "socialImage": "", "layers": [ - "nature_reserve", + { + "builtin": "nature_reserve", + "override": { + "source": { + "osmTags": { + "+and": [ + "operator~.*[nN]atuurpunt.*" + ] + } + } + } + }, "drinking_water", "bench", "bench_at_pt", From 87e64be56509ce3436c1f82f0529ee41aacf69dd Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 7 Jul 2021 15:19:05 +0200 Subject: [PATCH 2/2] Add warning for empty files --- scripts/ScriptUtils.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/ScriptUtils.ts b/scripts/ScriptUtils.ts index ccf230275e..135002495b 100644 --- a/scripts/ScriptUtils.ts +++ b/scripts/ScriptUtils.ts @@ -102,7 +102,12 @@ export default class ScriptUtils { .filter(path => path.indexOf("license_info.json") < 0) .map(path => { try { - const parsed = JSON.parse(readFileSync(path, "UTF8")); + const contents = readFileSync(path, "UTF8") + if(contents === ""){ + throw "The file "+path+" is empty, did you properly save?" + } + + const parsed = JSON.parse(contents); return {parsed: parsed, path: path} } catch (e) { console.error("Could not parse file ", "./assets/layers/" + path, "due to ", e) @@ -116,7 +121,11 @@ export default class ScriptUtils { .filter(path => path.indexOf("license_info.json") < 0) .map(path => { try { - const parsed = JSON.parse(readFileSync(path, "UTF8")); + const contents = readFileSync(path, "UTF8"); + if(contents === ""){ + throw "The file "+path+" is empty, did you properly save?" + } + const parsed = JSON.parse(contents); return {parsed: parsed, path: path} } catch (e) { console.error("Could not read file ", path, "due to ", e)