diff --git a/Logic/ExtraFunction.ts b/Logic/ExtraFunction.ts
index e53f34bda9..51f4ff9f93 100644
--- a/Logic/ExtraFunction.ts
+++ b/Logic/ExtraFunction.ts
@@ -110,7 +110,7 @@ Some advanced functions are available on feat as well:
let closestFeature = undefined;
let closestDistance = undefined;
for (const otherFeature of features) {
- if (otherFeature == feature) {
+ if (otherFeature == feature || otherFeature.id == feature.id) {
continue; // We ignore self
}
let distance = undefined;
diff --git a/Logic/MetaTagging.ts b/Logic/MetaTagging.ts
index 659118f3c6..635e72166d 100644
--- a/Logic/MetaTagging.ts
+++ b/Logic/MetaTagging.ts
@@ -3,6 +3,7 @@ import SimpleMetaTagger from "./SimpleMetaTagger";
import {ExtraFunction} from "./ExtraFunction";
import {Relation} from "./Osm/ExtractRelations";
import FeatureSource from "./FeatureSource/FeatureSource";
+import State from "../State";
interface Params {
@@ -48,7 +49,7 @@ export default class MetaTagging {
}
const featuresPerLayer = new Map();
- for (const feature of features) {
+ for (const feature of (allKnownFeatures.features?.data ?? features ?? [])) {
const key = feature.feature._matching_layer_id;
if (!featuresPerLayer.has(key)) {
@@ -57,13 +58,14 @@ export default class MetaTagging {
featuresPerLayer.get(key).push(feature.feature)
}
- for (const feature of (allKnownFeatures.features?.data ?? features ?? [])) {
+ for (const feature of features) {
// @ts-ignore
const key = feature.feature._matching_layer_id;
const f = layerFuncs.get(key);
if (f === undefined) {
continue;
}
+
try {
f({featuresPerLayer: featuresPerLayer, memberships: relations}, feature.feature)
} catch (e) {
@@ -72,6 +74,7 @@ export default class MetaTagging {
}
+
}
@@ -97,14 +100,14 @@ export default class MetaTagging {
const f = (featuresPerLayer, feature: any) => {
try {
let result = func(feature);
- if(result === undefined || result === ""){
+ if (result === undefined || result === "") {
return;
}
- if(typeof result !== "string"){
+ if (typeof result !== "string") {
// Make sure it is a string!
result = "" + result;
}
- feature.properties[key] = result;
+ 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)
}
diff --git a/index.ts b/index.ts
index 4ae2a56884..c6391f25b1 100644
--- a/index.ts
+++ b/index.ts
@@ -106,6 +106,8 @@ if (layoutFromBase64.startsWith("http")) {
let parsed = data;
if (typeof parsed == "string") {
parsed = JSON.parse(data);
+ }else{
+ data = JSON.stringify(parsed) // De wereld op zijn kop
}
// Overwrite the id to the wiki:value
parsed.id = link;
diff --git a/scripts/ScriptUtils.ts b/scripts/ScriptUtils.ts
index 93521089ee..220c9e2809 100644
--- a/scripts/ScriptUtils.ts
+++ b/scripts/ScriptUtils.ts
@@ -4,15 +4,18 @@ import {LayerConfigJson} from "../Customizations/JSON/LayerConfigJson";
import {LayoutConfigJson} from "../Customizations/JSON/LayoutConfigJson";
export default class ScriptUtils {
- public static readDirRecSync(path): string[] {
+ public static readDirRecSync(path, maxDepth = 999): string[] {
const result = []
+ if(maxDepth <= 0){
+ return []
+ }
for (const entry of readdirSync(path)) {
const fullEntry = path + "/" + entry
const stats = lstatSync(fullEntry)
if (stats.isDirectory()) {
// Subdirectory
// @ts-ignore
- result.push(...ScriptUtils.readDirRecSync(fullEntry))
+ result.push(...ScriptUtils.readDirRecSync(fullEntry, maxDepth - 1))
} else {
result.push(fullEntry)
}
diff --git a/scripts/generateTranslations.ts b/scripts/generateTranslations.ts
index fde7c82f8a..bb61fac4aa 100644
--- a/scripts/generateTranslations.ts
+++ b/scripts/generateTranslations.ts
@@ -165,7 +165,7 @@ function genTranslations() {
// Read 'lang/*.json', writes to 'assets/generated/translations.json'
function compileTranslationsFromWeblate() {
- const translations = ScriptUtils.readDirRecSync("./langs")
+ const translations = ScriptUtils.readDirRecSync("./langs", 1)
.filter(path => path.indexOf(".json") > 0)
const allTranslations = new TranslationPart()