diff --git a/src/Logic/GeoOperations.ts b/src/Logic/GeoOperations.ts index 04c863d8e..e6081f231 100644 --- a/src/Logic/GeoOperations.ts +++ b/src/Logic/GeoOperations.ts @@ -314,7 +314,7 @@ export class GeoOperations { return way } - public static toCSV(features: any[]): string { + public static toCSV(features: Feature[] | FeatureCollection): string { const headerValuesSeen = new Set() const headerValuesOrdered: string[] = [] @@ -330,7 +330,14 @@ export class GeoOperations { const lines: string[] = [] - for (const feature of features) { + let _features + if(Array.isArray(features)){ + _features = features + }else{ + _features = features.features + } + + for (const feature of _features) { const properties = feature.properties for (const key in properties) { if (!properties.hasOwnProperty(key)) { @@ -340,7 +347,7 @@ export class GeoOperations { } } headerValuesOrdered.sort() - for (const feature of features) { + for (const feature of _features) { const properties = feature.properties let line = "" for (const key of headerValuesOrdered) { diff --git a/src/Utils/svgToPdf.ts b/src/Utils/svgToPdf.ts index d591b9f14..09e1a66fd 100644 --- a/src/Utils/svgToPdf.ts +++ b/src/Utils/svgToPdf.ts @@ -672,16 +672,21 @@ class SvgToPdfPage { } public async PrepareLanguage(language: string) { + let host = window.location.host + if(host.startsWith("127.0.0.1")){ + host = "mapcomplete.org" + } // Always fetch the remote data - it's cached anyway this.layerTranslations[language] = await Utils.downloadJsonCached( window.location.protocol + "//" + - window.location.host + + host + "/assets/langs/layers/" + language + ".json", 24 * 60 * 60 * 1000 ) + } public async Prepare() {