diff --git a/Logic/MetaTagging.ts b/Logic/MetaTagging.ts index ee13c3c105..052cb30ee5 100644 --- a/Logic/MetaTagging.ts +++ b/Logic/MetaTagging.ts @@ -27,6 +27,10 @@ export default class MetaTagging { relations: Map, layers: LayerConfig[], includeDates = true) { + + if(features === undefined || features.length === 0){ + return; + } for (const metatag of SimpleMetaTagger.metatags) { if (metatag.includesDates && !includeDates) { @@ -49,10 +53,9 @@ export default class MetaTagging { allKnownFeatures.features.addCallbackAndRun(newFeatures => { - - const featuresPerLayer = new Map(); - for (const feature of (newFeatures.concat(features))) { + const allFeatures = Array.from(new Set(features.concat(newFeatures))) + for (const feature of allFeatures) { const key = feature.feature._matching_layer_id; if (!featuresPerLayer.has(key)) { @@ -87,6 +90,7 @@ export default class MetaTagging { } + private static errorPrintCount = 0; private static createRetaggingFunc(layer: LayerConfig): ((params: Params, feature: any) => void) { @@ -119,7 +123,13 @@ export default class MetaTagging { } feature.properties[key] = result; } catch (e) { - console.error("Could not calculate a metatag defined by " + code + " due to " + e + ". This is code defined in the theme. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features", e) + if(MetaTagging. errorPrintCount < 50){ + console.error("Could not calculate a metatag defined by " + code + " due to " + e + ". This is code defined in the theme. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features", e) + MetaTagging. errorPrintCount ++; + if(MetaTagging. errorPrintCount == 50){ + console.error("Got 50 errors calculating this metatagging - stopping output now") + } + } } } diff --git a/Logic/Osm/OsmObject.ts b/Logic/Osm/OsmObject.ts index 9b35b48266..363678d8de 100644 --- a/Logic/Osm/OsmObject.ts +++ b/Logic/Osm/OsmObject.ts @@ -363,8 +363,6 @@ export class OsmWay extends OsmObject { let latSum = 0 let lonSum = 0 - console.log("element is", element, "nodes are", allNodes) - const nodeDict = new Map() for (const node of allNodes) { nodeDict.set(node.id, node)