Fix: CSV download
This commit is contained in:
parent
c2164e5951
commit
c1bce7abc7
2 changed files with 16 additions and 4 deletions
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue