Fix: CSV download

This commit is contained in:
Pieter Vander Vennet 2023-10-19 12:16:44 +02:00
parent c2164e5951
commit c1bce7abc7
2 changed files with 16 additions and 4 deletions

View file

@ -314,7 +314,7 @@ export class GeoOperations {
return <any>way
}
public static toCSV(features: any[]): string {
public static toCSV(features: Feature[] | FeatureCollection): string {
const headerValuesSeen = new Set<string>()
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) {

View file

@ -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() {