diff --git a/Models/ThemeConfig/Conversion/Validation.ts b/Models/ThemeConfig/Conversion/Validation.ts index c28886088..9b5f25989 100644 --- a/Models/ThemeConfig/Conversion/Validation.ts +++ b/Models/ThemeConfig/Conversion/Validation.ts @@ -10,6 +10,7 @@ import {TagRenderingConfigJson} from "../Json/TagRenderingConfigJson"; import {TagUtils} from "../../../Logic/Tags/TagUtils"; import {ExtractImages} from "./FixImages"; import ScriptUtils from "../../../scripts/ScriptUtils"; +import {And} from "../../../Logic/Tags/And"; class ValidateLanguageCompleteness extends DesugaringStep { @@ -339,6 +340,24 @@ export class ValidateLayer extends DesugaringStep { new DetectShadowedMappings().convertAll(json.tagRenderings, context + ".tagRenderings") } + if(json.presets !== undefined){ + + // Check that a preset will be picked up by the layer itself + const baseTags = TagUtils.Tag( json.source.osmTags) + for (let i = 0; i < json.presets.length; i++){ + const preset = json.presets[i]; + const tags : {k: string,v: string}[]= new And(preset.tags.map(t => TagUtils.Tag(t))).asChange({id:"node/-1"}) + const properties = {} + for (const tag of tags) { + properties[tag.k] = tag.v + } + const doMatch = baseTags.matchesProperties(properties) + if(!doMatch){ + errors.push(context+".presets["+i+"]: This preset does not match the required tags of this layer. This implies that a newly added point will not show up.\n A newly created point will have properties: "+JSON.stringify(properties)+"\n The required tags are: "+baseTags.asHumanString(false, false, {})) + } + } + } + } catch (e) { errors.push(e) } diff --git a/assets/themes/cyclenodes/cyclenodes.json b/assets/themes/cyclenodes/cyclenodes.json index c3980cd8b..1d82601d2 100644 --- a/assets/themes/cyclenodes/cyclenodes.json +++ b/assets/themes/cyclenodes/cyclenodes.json @@ -127,25 +127,6 @@ "de": "Knotenpunkt {rcn_ref}" } }, - "presets": [ - { - "title": { - "de": "Knotenpunkt" - }, - "tags": [ - "network:type=node_network" - ] - }, - { - "title": { - "de": "Knotenpunkt im Netzwerk Spree-Neiße" - }, - "tags": [ - "network:type=node_network", - "cycle_network=Knotenpunktwegweisung Spree-Neiße" - ] - } - ], "tagRenderings": [ { "question": { diff --git a/assets/themes/fritures/fritures.json b/assets/themes/fritures/fritures.json index ce93ccc89..403422bf7 100644 --- a/assets/themes/fritures/fritures.json +++ b/assets/themes/fritures/fritures.json @@ -28,6 +28,7 @@ "it": "Friggitoria", "hu": "Sültkrumplievő-hely" }, + "=presets": [], "source": { "=osmTags": { "and": [ @@ -47,7 +48,8 @@ "builtin": "food", "override": { "minzoom": 19, - "filter": null + "filter": null, + "name": null } } ] diff --git a/assets/themes/natuurpunt/natuurpunt.json b/assets/themes/natuurpunt/natuurpunt.json index 28663c6f8..98f5619f9 100644 --- a/assets/themes/natuurpunt/natuurpunt.json +++ b/assets/themes/natuurpunt/natuurpunt.json @@ -77,7 +77,8 @@ ], "=filter": { "sameAs": "nature_reserve_centerpoints" - } + }, + "=presets": [] } }, { @@ -103,6 +104,9 @@ }, "presets": [] } + ], + "presets": [ + {"tags+": "operator=Natuurpunt"} ] } }, @@ -193,6 +197,10 @@ "builtin": "birdhide", "override": { "minzoom": 14, + "presets": [ + {"tags+": "operator=Natuurpunt"}, + {"tags+": "operator=Natuurpunt"} + ], "source": { "geoJson": "https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/natuurpunt_cache/natuurpunt_{layer}_{z}_{x}_{y}.geojson", "geoJsonZoomLevel": 12, diff --git a/assets/themes/uk_addresses/uk_addresses.json b/assets/themes/uk_addresses/uk_addresses.json index 8737ddeba..febb712fe 100644 --- a/assets/themes/uk_addresses/uk_addresses.json +++ b/assets/themes/uk_addresses/uk_addresses.json @@ -139,8 +139,8 @@ "id": "to_handle", "options": [ { - "question": "Only show non-matched objects", "default": true, + "question": "Only show non-matched objects", "osmTags": { "and": [ "_imported=",