From 28111b8e9a5f4b3ef53ff856a231a3b099234c04 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 27 May 2024 18:31:30 +0200 Subject: [PATCH] Include 'lighthouses' as official theme --- assets/layers/lighthouse/lighthouse.json | 75 +++++++++ assets/themes/lighthouses/license_info.json | 12 ++ assets/themes/lighthouses/lighthouse.svg | 153 ++++++++++++++++++ .../themes/lighthouses/lighthouse.svg.license | 2 + assets/themes/lighthouses/lighthouses.json | 18 +++ src/Models/Unit.ts | 3 + 6 files changed, 263 insertions(+) create mode 100644 assets/layers/lighthouse/lighthouse.json create mode 100644 assets/themes/lighthouses/license_info.json create mode 100644 assets/themes/lighthouses/lighthouse.svg create mode 100644 assets/themes/lighthouses/lighthouse.svg.license create mode 100644 assets/themes/lighthouses/lighthouses.json diff --git a/assets/layers/lighthouse/lighthouse.json b/assets/layers/lighthouse/lighthouse.json new file mode 100644 index 000000000..bcfa909b4 --- /dev/null +++ b/assets/layers/lighthouse/lighthouse.json @@ -0,0 +1,75 @@ +{ + "id": "lighthouse", + "name": { + "en": "lighthouse" + }, + "source": { + "osmTags": "man_made=lighthouse" + }, + "minzoom": 5, + "title": { + "render": { + "en": "lighthouse" + }, + "mappings": [ + { + "if": "name~*", + "then": { + "en": "{name}" + } + } + ] + }, + "tagRenderings": [ + "images", + "wikipedia", + { + "render": { + "en": "The height of this lighthouse is {height} metres." + }, + "question": { + "en": "What is the height of this lighthouse, in metres?" + }, + "freeform": { + "key": "height", + "type": "pfloat" + }, + "id": "lighthouse-height" + } + ], + "presets": [ + { + "tags": [ + "man_made=lighthouse" + ], + "title": { + "en": "a lighthouse" + } + } + ], + "pointRendering": [ + { + "location": [ + "point", + "centroid" + ], + "marker": [ + { + "icon": "./assets/themes/lighthouses/lighthouse.svg" + } + ], + "anchor": "bottom" + } + ], + "lineRendering": [], + "units": [ + { + "height": { + "quantity": "distance", + "denominations": [ + "m" + ] + } + } + ] +} \ No newline at end of file diff --git a/assets/themes/lighthouses/license_info.json b/assets/themes/lighthouses/license_info.json new file mode 100644 index 000000000..d9c16ebc2 --- /dev/null +++ b/assets/themes/lighthouses/license_info.json @@ -0,0 +1,12 @@ +[ + { + "path": "lighthouse.svg", + "license": "CC0-1.0", + "authors": [ + "Staszek Szybki Jest" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:Lighthouse_icon_red.svg" + ] + } +] \ No newline at end of file diff --git a/assets/themes/lighthouses/lighthouse.svg b/assets/themes/lighthouses/lighthouse.svg new file mode 100644 index 000000000..67cce1f50 --- /dev/null +++ b/assets/themes/lighthouses/lighthouse.svg @@ -0,0 +1,153 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/themes/lighthouses/lighthouse.svg.license b/assets/themes/lighthouses/lighthouse.svg.license new file mode 100644 index 000000000..d6a8addcd --- /dev/null +++ b/assets/themes/lighthouses/lighthouse.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Staszek Szybki Jest +SPDX-License-Identifier: CC0-1.0 \ No newline at end of file diff --git a/assets/themes/lighthouses/lighthouses.json b/assets/themes/lighthouses/lighthouses.json new file mode 100644 index 000000000..58cbbc85e --- /dev/null +++ b/assets/themes/lighthouses/lighthouses.json @@ -0,0 +1,18 @@ +{ + "id": "lighthouses", + "title": { + "en": "Lighthouses" + }, + "description": { + "en": "Lighthouses are tall buildings with a light on top to guide marine traffic." + }, + "icon": "./assets/themes/lighthouses/lighthouse.svg", + "startZoom": 0, + "startLat": 51.33884, + "startLon": 3.14154, + "defaultBackgroundId": "protomaps.white", + "credits": "Seppe Santens", + "layers": [ + "lighthouse" + ] +} \ No newline at end of file diff --git a/src/Models/Unit.ts b/src/Models/Unit.ts index 2a82a8ee0..20ae49aed 100644 --- a/src/Models/Unit.ts +++ b/src/Models/Unit.ts @@ -246,6 +246,9 @@ export class Unit { return found } + if(!Array.isArray(toLoad.denominations)){ + throw "toLoad is not an array. Did you forget the [ and ] around the denominations at "+ctx+"?" + } const denoms = toLoad.denominations .map((d) => d.toLowerCase()) .map((d) => fetchDenom(d))