From b67e108056b9107ba47ccfa96db9b35c7f5778b8 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Fri, 18 Mar 2022 13:08:04 +0100 Subject: [PATCH] Fix caching script --- scripts/generateCache.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/generateCache.ts b/scripts/generateCache.ts index 36f3303ce..d7d9706ed 100644 --- a/scripts/generateCache.ts +++ b/scripts/generateCache.ts @@ -274,9 +274,15 @@ function sliceToTiles(allFeatures: FeatureSource, theme: LayoutConfig, relations // Evaluate all the calculated tags strictly const calculatedTagKeys = tile.layer.layerDef.calculatedTags.map(ct => ct[0]) featureCount++ + const props = feature.feature.properties for (const calculatedTagKey of calculatedTagKeys) { - const strict = feature.feature.properties[calculatedTagKey] - feature.feature.properties[calculatedTagKey] = strict + const strict = props[calculatedTagKey] + + if(props.hasOwnProperty(calculatedTagKey)){ + delete props[calculatedTagKey] + } + + props[calculatedTagKey] = strict strictlyCalculated++; if (strictlyCalculated % 100 === 0) { console.log("Strictly calculated ", strictlyCalculated, "values for tile", tileIndex, ": now at ", featureCount, "/", filteredTile.features.data.length, "examle value: ", strict)