diff --git a/.gitignore b/.gitignore index e35aefa..dc6f476 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ node_modules scratch assets/editor-layer-index.json assets/generated/* +/*.webmanifest +/*.html +!/index.html diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts index e1d0889..3195daa 100644 --- a/Customizations/AllKnownLayouts.ts +++ b/Customizations/AllKnownLayouts.ts @@ -17,6 +17,7 @@ import * as widths from "../assets/themes/widths/width.json" import * as drinking_water from "../assets/themes/drinking_water/drinking_water.json" import * as climbing from "../assets/themes/climbing/climbing.json" import * as surveillance_cameras from "../assets/themes/surveillance_cameras/surveillance_cameras.json" +import * as trees from "../assets/themes/trees/trees.json" import * as personal from "../assets/themes/personalLayout/personalLayout.json" import * as playgrounds from "../assets/themes/playgrounds/playgrounds.json" import LayerConfig from "./JSON/LayerConfig"; @@ -65,7 +66,8 @@ export class AllKnownLayouts { new LayoutConfig(bike_monitoring_stations), new LayoutConfig(surveillance_cameras), new LayoutConfig(climbing), - new LayoutConfig(playgrounds) + new LayoutConfig(playgrounds), + new LayoutConfig(trees), ]; diff --git a/Customizations/SharedLayers.ts b/Customizations/SharedLayers.ts index 0e3fd1f..cb2acca 100644 --- a/Customizations/SharedLayers.ts +++ b/Customizations/SharedLayers.ts @@ -17,6 +17,7 @@ import * as direction from "../assets/layers/direction/direction.json" import * as surveillance_camera from "../assets/layers/surveillance_cameras/surveillance_cameras.json" import * as toilets from "../assets/layers/toilets/toilets.json" import * as bookcases from "../assets/layers/public_bookcases/public_bookcases.json" +import * as tree_nodes from "../assets/layers/trees/tree_nodes.json" import LayerConfig from "./JSON/LayerConfig"; export default class SharedLayers { @@ -45,7 +46,8 @@ export default class SharedLayers { new LayerConfig(information_boards,[], "shared_layers"), new LayerConfig(toilets,[], "shared_layers"), new LayerConfig(bookcases,[], "shared_layers"), - new LayerConfig(surveillance_camera,[], "shared_layers") + new LayerConfig(surveillance_camera,[], "shared_layers"), + new LayerConfig(tree_nodes,[], "shared_layers") ]; const sharedLayers = new Map(); @@ -57,4 +59,4 @@ export default class SharedLayers { } -} \ No newline at end of file +} diff --git a/Folder.DotSettings.user b/Folder.DotSettings.user new file mode 100644 index 0000000..e9e707c --- /dev/null +++ b/Folder.DotSettings.user @@ -0,0 +1,2 @@ + + ShowAndRun \ No newline at end of file diff --git a/assets/layers/trees/tree_nodes.json b/assets/layers/trees/tree_nodes.json new file mode 100644 index 0000000..fc0fc59 --- /dev/null +++ b/assets/layers/trees/tree_nodes.json @@ -0,0 +1,418 @@ +{ + "id": "tree_nodes", + "name": { + "nl": "Boom", + "en": "Tree" + }, + "minzoom": 18, + "overpassTags": { + "and": ["natural=tree"] + }, + "title": { + "render": { + "nl": "Boom", + "en": "Tree" + }, + "mappings": [ + { + "if": "name~*", + "then": { + "nl": "{name}", + "en": "{name}" + } + } + ] + }, + "tagRenderings": [ + "images", + { + "render": { + "nl": "Hoogte: {height}", + "en": "Height: {height}" + }, + "condition": { + "and": [ + "height~*" + ] + }, + "mappings": [ + { + "if": { + "and": ["height~^[0-9.]+$"] + }, + "then": { + "nl": "Hoogte: {height} m", + "en": "Height: {height} m" + } + } + ] + }, + { + "question": { + "nl": "Is dit een naald- of loofboom?", + "en": "Is this a broadleaved or needleleaved tree?" + }, + "mappings": [ + { + "if": { + "and": ["leaf_type=broadleaved"] + }, + "then": { + "nl": "\"\"/ Loofboom", + "en": "\"\"/ Broadleaved" + } + }, + { + "if": { + "and": ["leaf_type=needleleaved"] + }, + "then": { + "nl": "\"\"/ Naaldboom", + "en": "\"\"/ Needleleaved" + } + }, + { + "if": { + "and": ["leaf_type=leafless"] + }, + "then": { + "nl": "\"\"/ Permanent bladloos", + "en": "\"\"/ Permanently leafless" + }, + "hideInAnswer": true + } + ] + }, + { + "question": { + "nl": "Hoe significant is deze boom? Kies het eerste antwoord dat van toepassing is.", + "en": "How significant is this tree? Choose the first answer that applies." + }, + "mappings": [ + { + "if": { + "and": ["denotation=landmark"] + }, + "then": { + "nl": "De boom valt op door zijn grootte of prominente locatie. Hij is nuttig voor navigatie.", + "en": "The tree is remarkable due to its size or prominent location. It is useful for navigation." + } + }, + { + "if": { + "and": ["denotation=natural_monument"] + }, + "then": { + "nl": "De boom is een natuurlijk monument, bijvoorbeeld doordat hij bijzonder oud of van een waardevolle soort is.", + "en": "The tree is a natural monument, e.g. because it is especially old, or of a valuable species." + } + }, + { + "if": { + "and": ["denotation=agricultural"] + }, + "then": { + "nl": "De boom wordt voor landbouwdoeleinden gebruikt, bijvoorbeeld in een boomgaard.", + "en": "The tree is used for agricultural purposes, e.g. in an orchard." + } + }, + { + "if": { + "and": ["denotation=park"] + }, + "then": { + "nl": "De boom staat in een park of dergelijke (begraafplaats, schoolterrein, …).", + "en": "The tree is in a park or similar (cemetery, school grounds, …)." + } + }, + { + "if": { + "and": ["denotation=garden"] + }, + "then": { + "nl": "De boom staat in de tuin bij een woning/flatgebouw.", + "en": "The tree is a residential garden." + } + }, + { + "if": { + "and": ["denotation=avenue"] + }, + "then": { + "nl": "Dit is een laanboom.", + "en": "This is a tree along an avenue." + } + }, + { + "if": { + "and": ["denotation=urban"] + }, + "then": { + "nl": "De boom staat in een woonkern.", + "en": "The tree is an urban area." + } + }, + { + "if": { + "and": ["denotation=none"] + }, + "then": { + "nl": "De boom staat buiten een woonkern.", + "en": "The tree is outside of an urban area." + } + } + ] + }, + { + "question": { + "nl": "Is deze boom groenblijvend of bladverliezend?", + "en": "Is this tree evergreen or deciduous?" + }, + "mappings": [ + { + "if": { + "and": ["leaf_cycle=deciduous"] + }, + "then": { + "nl": "Bladverliezend: de boom is een periode van het jaar kaal.", + "en": "Deciduous: the tree loses its leaves for some time of the year." + } + }, + { + "if": { + "and": ["leaf_cycle=evergreen"] + }, + "then": { + "nl": "Groenblijvend.", + "en": "Evergreen." + } + } + ], + "condition": { + "and": ["leaf_type!~^leafless$"] + } + }, + { + "render": { + "nl": "Naam: {name}", + "en": "Naam: {name}" + }, + "question": { + "nl": "Heeft de boom een naam?", + "en": "Does the tree have a name?" + }, + "freeform": { + "key": "name", + "addExtraTags": [ + "noname=" + ] + }, + "mappings": [ + { + "if": { + "and": [ + "name=", + "noname=yes" + ] + }, + "then": { + "nl": "De boom heeft geen naam.", + "en": "The tree does not have a name." + } + } + ], + "condition": { + "or": [ + "denotation=landmark", + "denotation=natural_monument", + "name~*" + ] + } + }, + { + "question": { + "nl": "Is deze boom erkend als erfgoed?", + "en": "Is this tree registered heritage?" + }, + "mappings": [ + { + "if": { + "and": [ + "heritage=4", + "heritage:operator=OnroerendErfgoed" + ] + }, + "then": { + "nl": "\"\"/ Erkend als houtig erfgoed door Onroerend Erfgoed Vlaanderen", + "en": "\"\"/ Registered as heritage by Onroerend Erfgoed Flanders" + } + }, + { + "if": { + "and": [ + "heritage=4", + "heritage:operator=aatl" + ] + }, + "then": { + "nl": "Erkend als natuurlijk erfgoed door Directie Cultureel Erfgoed Brussel", + "en": "Registered as heritage by Direction du Patrimoine culturel Brussels" + } + }, + { + "if": { + "and": [ + "heritage=yes", + "heritage:operator=" + ] + }, + "then": { + "nl": "Erkend als erfgoed door een andere organisatie", + "en": "Registered as heritage by a different organisation" + } + }, + { + "if": { + "and": [ + "heritage=no", + "heritage:operator=" + ] + }, + "then": { + "nl": "Niet erkend als erfgoed", + "en": "Not registered as heritage" + } + }, + { + "if": { + "and": [ + "heritage~*" + ] + }, + "then": { + "nl": "Erkend als erfgoed door een andere organisatie", + "en": "Registered as heritage by a different organisation" + }, + "hideInAnswer": true + } + ], + "condition": { + "or": [ + "denotation=landmark", + "denotation=natural_monument" + ] + } + }, + { + "render": { + "nl": "\"\"/ Onroerend Erfgoed-ID: {ref:OnroerendErfgoed}", + "en": "\"\"/ Onroerend Erfgoed ID: {ref:OnroerendErfgoed}" + }, + "question": { + "nl": "Wat is het ID uitgegeven door Onroerend Erfgoed Vlaanderen?", + "en": "What is the ID issuesd by Onroerend Erfgoed Flanders?" + }, + "freeform": { + "key": "ref:OnroerendErfgoed", + "type": "nat" + }, + "condition": { + "and": [ + "heritage=4", + "heritage:operator=OnroerendErfgoed" + ] + } + }, + { + "render": { + "nl": "\"\"/ Wikidata: {wikidata}", + "en": "\"\"/ Wikidata: {wikidata}" + }, + "question": { + "nl": "Wat is het Wikidata-ID van deze boom?", + "en": "What is the Wikidata ID for this tree?" + }, + "freeform": { + "key": "wikidata", + "type": "wikidata" + }, + "condition": { + "or": [ + "denotation=landmark", + "denotation=natural_monument", + "wikidata~*" + ] + } + } + ], + "hideUnderlayingFeaturesMinPercentage": 0, + "icon": { + "render": "./assets/themes/trees/unknown.svg", + "mappings": [ + { + "if": { + "and": ["leaf_type=broadleaved"] + }, + "then": "./assets/themes/trees/broadleaved.svg" + }, + { + "if": { + "and": ["leaf_type=needleleaved"] + }, + "then": "./assets/themes/trees/needleleaved.svg" + } + ] + }, + "width": { + "render": "8" + }, + "iconSize": { + "render": "40,40,bottom" + }, + "color": { + "render": "#00f" + }, + "presets": [ + { + "tags": [ + "natural=tree", + "leaf_type=broadleaved" + ], + "title": { + "nl": "Loofboom", + "en": "Broadleaved tree" + }, + "description": { + "nl": "Een boom van een soort die blaadjes heeft, bijvoorbeeld eik of populier.", + "en": "A tree of a species with leaves, such as oak or populus." + } + }, + { + "tags": [ + "natural=tree", + "leaf_type=needleleaved" + ], + "title": { + "nl": "Naaldboom", + "en": "Needleleaved tree" + }, + "description": { + "nl": "Een boom van een soort met naalden, bijvoorbeeld den of spar.", + "en": "A tree of a species with needles, such as pine or spruce." + } + }, + { + "tags": [ + "natural=tree" + ], + "title": { + "nl": "Boom", + "en": "Tree" + }, + "description": { + "nl": "Wanneer je niet zeker bent of het nu een loof- of naaldboom is.", + "en": "If you're not sure whether it's a broadleaved or needleleaved tree." + } + } + ] +} diff --git a/assets/themes/trees/broadleaved.svg b/assets/themes/trees/broadleaved.svg new file mode 100644 index 0000000..1f78875 --- /dev/null +++ b/assets/themes/trees/broadleaved.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/themes/trees/leafless.svg b/assets/themes/trees/leafless.svg new file mode 100644 index 0000000..b3f285d --- /dev/null +++ b/assets/themes/trees/leafless.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/themes/trees/logo.svg b/assets/themes/trees/logo.svg new file mode 100644 index 0000000..38579c2 --- /dev/null +++ b/assets/themes/trees/logo.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/themes/trees/needleleaved.svg b/assets/themes/trees/needleleaved.svg new file mode 100644 index 0000000..7b4f2e5 --- /dev/null +++ b/assets/themes/trees/needleleaved.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/themes/trees/trees.json b/assets/themes/trees/trees.json new file mode 100644 index 0000000..4133fcf --- /dev/null +++ b/assets/themes/trees/trees.json @@ -0,0 +1,32 @@ +{ + "id": "trees", + "title": { + "nl": "Bomen", + "en": "Trees" + }, + "shortDescription": { + "nl": "Breng bomen in kaart", + "en": "Map all the trees" + }, + "description": { + "nl": "Breng bomen in kaart!", + "en": "Map all the trees!" + }, + "language": [ + "nl", + "en" + ], + "maintainer": "Midgard", + "icon": "./assets/themes/trees/logo.svg", + "version": "0", + "startLat": 50.642, + "startLon": 4.482, + "startZoom": 8, + "widenFactor": 0.01, + "socialImage": "./assets/themes/trees/logo.svg", + "layers": [ + "tree_nodes" + ], + "roamingRenderings": [], + "defaultBackgroundId": "AGIV" +} diff --git a/assets/themes/trees/unknown.svg b/assets/themes/trees/unknown.svg new file mode 100644 index 0000000..1477b86 --- /dev/null +++ b/assets/themes/trees/unknown.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/index.html b/index.html index abc12e7..b2dda3b 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - + @@ -19,7 +19,7 @@ - + @@ -68,5 +68,6 @@ + diff --git a/index.ts b/index.ts index f55db7c..cca3c68 100644 --- a/index.ts +++ b/index.ts @@ -73,7 +73,9 @@ if (layoutFromBase64.startsWith("wiki:")) { new FixedUiElement(`Downloading ${themeName} from the wiki...`) .AttachTo("centermessage"); const cleanUrl = `https://wiki.openstreetmap.org/wiki/${themeName}`; - const url = `https://cors-anywhere.herokuapp.com/` + cleanUrl; // VERY SAFE AND HACKER-PROOF! + const url = `https://cors-anywhere.herokuapp.com/` + cleanUrl; // ~NOT~ VERY SAFE AND HACKER-PROOF! + /*/ + const url = cleanUrl; // MUCH SAFER! //*/ $.ajax({ url: url,