diff --git a/assets/layers/matchpoint/matchpoint.json b/assets/layers/matchpoint/matchpoint.json deleted file mode 100644 index 16375a75a2..0000000000 --- a/assets/layers/matchpoint/matchpoint.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "matchpoint", - "description": "The default rendering for a locationInput which snaps onto another object", - "source": "special", - "mapRendering": [ - { - "location": [ - "point", - "centroid" - ], - "icon": "./assets/svg/crosshair-empty.svg" - } - ] -} diff --git a/assets/layers/recycling/recycling.json b/assets/layers/recycling/recycling.json index f85b8abd6b..86ac8e6c3b 100644 --- a/assets/layers/recycling/recycling.json +++ b/assets/layers/recycling/recycling.json @@ -23,7 +23,7 @@ "osmTags": "amenity=recycling" }, "calculatedTags": [ - "_waste_amount=Object.values(Object.keys(feat.properties).filter((key) => key.startsWith('recycling:')).reduce((cur, key) => { return Object.assign(cur, { [key]: feat.properties[key] })}, {})).reduce((n, x) => n + (x == \"yes\"), 0);" + "_waste_amount=Object.keys(feat.properties).filter(key => key.startsWith('recycling:')).filter(k => feat.properties[k] === 'yes').length" ], "minzoom": 10, "title": { @@ -1569,4 +1569,4 @@ "enableRelocation": true, "enableImproveAccuracy": true } -} \ No newline at end of file +} diff --git a/assets/layers/school/school.json b/assets/layers/school/school.json index a94b25a4f0..c2ea234a9c 100644 --- a/assets/layers/school/school.json +++ b/assets/layers/school/school.json @@ -20,7 +20,7 @@ } }, "calculatedTags": [ - "_enclosing=feat.enclosingFeatures('school').map(f => f.feat.properties.id)", + "_enclosing=enclosingFeatures(feat)('school').map(f => f.feat.properties.id)", "_is_enclosed=feat.properties._enclosing != '[]'" ], "isShown": { diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index 946b31c5d9..cceedfec93 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -424,11 +424,12 @@ class LayerOverviewUtils extends Script { ] for (const layer of themeFile.layers) { const l = layer + const id = l.id.replace(/[^a-zA-Z0-9_]/g, "_") const code = l.calculatedTags ?? [] allCode.push( " public metaTaggging_for_" + - l.id + + id + "(feat: Feature, helperFunctions: Record Function>) {" ) allCode.push(" const {" + ExtraFunctions.types.join(", ") + "} = helperFunctions") @@ -446,7 +447,7 @@ class LayerOverviewUtils extends Script { " ) " ) } else { - attributeName = attributeName.substring(0, attributeName.length - 2).trim() + attributeName = attributeName.substring(0, attributeName.length - 1).trim() allCode.push(" feat.properties['" + attributeName + "'] = " + expression) } } @@ -463,6 +464,9 @@ class LayerOverviewUtils extends Script { } private extractJavascriptCodeForLayer(l: LayerConfigJson, targetPath?: string) { + if (!l) { + return // Probably a bootstrapping run + } let importPath = "../../../" if (targetPath) { const l = targetPath.split("/") @@ -478,7 +482,7 @@ class LayerOverviewUtils extends Script { } const allCode = [ `import { Utils } from "${importPath}Utils"`, - `/** This code is autogenerated - do not edit. Edit ./assets/layers/${l.id}/${l.id}.json instead */`, + `/** This code is autogenerated - do not edit. Edit ./assets/layers/${l?.id}/${l?.id}.json instead */`, "export class ThemeMetaTagging {", " public static readonly themeName = " + JSON.stringify(l.id), "", diff --git a/src/Logic/MetaTagging.ts b/src/Logic/MetaTagging.ts index 081d8f0e4d..75cbcc712f 100644 --- a/src/Logic/MetaTagging.ts +++ b/src/Logic/MetaTagging.ts @@ -316,7 +316,9 @@ export default class MetaTagging { helpers: Record Function> ): (feature: Feature, tags: UIEventSource>) => boolean { if (MetaTagging.metataggingObject) { - const funcName = "metaTaggging_for_" + layer.id + const id = layer.id.replace(/[^a-zA-Z0-9_]/g, "_") + + const funcName = "metaTaggging_for_" + id if (typeof MetaTagging.metataggingObject[funcName] !== "function") { console.log(MetaTagging.metataggingObject) throw ( diff --git a/src/Models/Constants.ts b/src/Models/Constants.ts index 2d7a87e741..3edeebc876 100644 --- a/src/Models/Constants.ts +++ b/src/Models/Constants.ts @@ -37,7 +37,6 @@ export default class Constants { "split_point", "split_road", "current_view", - "matchpoint", "import_candidate", "usersettings", ] as const