Fix: build, some metatagging errors
This commit is contained in:
parent
df7b0f84db
commit
0d529e7cca
6 changed files with 13 additions and 22 deletions
|
@ -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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -23,7 +23,7 @@
|
||||||
"osmTags": "amenity=recycling"
|
"osmTags": "amenity=recycling"
|
||||||
},
|
},
|
||||||
"calculatedTags": [
|
"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,
|
"minzoom": 10,
|
||||||
"title": {
|
"title": {
|
||||||
|
@ -1569,4 +1569,4 @@
|
||||||
"enableRelocation": true,
|
"enableRelocation": true,
|
||||||
"enableImproveAccuracy": true
|
"enableImproveAccuracy": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"calculatedTags": [
|
"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 != '[]'"
|
"_is_enclosed=feat.properties._enclosing != '[]'"
|
||||||
],
|
],
|
||||||
"isShown": {
|
"isShown": {
|
||||||
|
|
|
@ -424,11 +424,12 @@ class LayerOverviewUtils extends Script {
|
||||||
]
|
]
|
||||||
for (const layer of themeFile.layers) {
|
for (const layer of themeFile.layers) {
|
||||||
const l = <LayerConfigJson>layer
|
const l = <LayerConfigJson>layer
|
||||||
|
const id = l.id.replace(/[^a-zA-Z0-9_]/g, "_")
|
||||||
const code = l.calculatedTags ?? []
|
const code = l.calculatedTags ?? []
|
||||||
|
|
||||||
allCode.push(
|
allCode.push(
|
||||||
" public metaTaggging_for_" +
|
" public metaTaggging_for_" +
|
||||||
l.id +
|
id +
|
||||||
"(feat: Feature, helperFunctions: Record<ExtraFuncType, (feature: Feature) => Function>) {"
|
"(feat: Feature, helperFunctions: Record<ExtraFuncType, (feature: Feature) => Function>) {"
|
||||||
)
|
)
|
||||||
allCode.push(" const {" + ExtraFunctions.types.join(", ") + "} = helperFunctions")
|
allCode.push(" const {" + ExtraFunctions.types.join(", ") + "} = helperFunctions")
|
||||||
|
@ -446,7 +447,7 @@ class LayerOverviewUtils extends Script {
|
||||||
" ) "
|
" ) "
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
attributeName = attributeName.substring(0, attributeName.length - 2).trim()
|
attributeName = attributeName.substring(0, attributeName.length - 1).trim()
|
||||||
allCode.push(" feat.properties['" + attributeName + "'] = " + expression)
|
allCode.push(" feat.properties['" + attributeName + "'] = " + expression)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -463,6 +464,9 @@ class LayerOverviewUtils extends Script {
|
||||||
}
|
}
|
||||||
|
|
||||||
private extractJavascriptCodeForLayer(l: LayerConfigJson, targetPath?: string) {
|
private extractJavascriptCodeForLayer(l: LayerConfigJson, targetPath?: string) {
|
||||||
|
if (!l) {
|
||||||
|
return // Probably a bootstrapping run
|
||||||
|
}
|
||||||
let importPath = "../../../"
|
let importPath = "../../../"
|
||||||
if (targetPath) {
|
if (targetPath) {
|
||||||
const l = targetPath.split("/")
|
const l = targetPath.split("/")
|
||||||
|
@ -478,7 +482,7 @@ class LayerOverviewUtils extends Script {
|
||||||
}
|
}
|
||||||
const allCode = [
|
const allCode = [
|
||||||
`import { Utils } from "${importPath}Utils"`,
|
`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 {",
|
"export class ThemeMetaTagging {",
|
||||||
" public static readonly themeName = " + JSON.stringify(l.id),
|
" public static readonly themeName = " + JSON.stringify(l.id),
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -316,7 +316,9 @@ export default class MetaTagging {
|
||||||
helpers: Record<ExtraFuncType, (feature: Feature) => Function>
|
helpers: Record<ExtraFuncType, (feature: Feature) => Function>
|
||||||
): (feature: Feature, tags: UIEventSource<Record<string, any>>) => boolean {
|
): (feature: Feature, tags: UIEventSource<Record<string, any>>) => boolean {
|
||||||
if (MetaTagging.metataggingObject) {
|
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") {
|
if (typeof MetaTagging.metataggingObject[funcName] !== "function") {
|
||||||
console.log(MetaTagging.metataggingObject)
|
console.log(MetaTagging.metataggingObject)
|
||||||
throw (
|
throw (
|
||||||
|
|
|
@ -37,7 +37,6 @@ export default class Constants {
|
||||||
"split_point",
|
"split_point",
|
||||||
"split_road",
|
"split_road",
|
||||||
"current_view",
|
"current_view",
|
||||||
"matchpoint",
|
|
||||||
"import_candidate",
|
"import_candidate",
|
||||||
"usersettings",
|
"usersettings",
|
||||||
] as const
|
] as const
|
||||||
|
|
Loading…
Reference in a new issue