forked from MapComplete/MapComplete
Small fixes to GenerateSeries-script
This commit is contained in:
parent
1cef57ba4a
commit
bdf40e2607
1 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
import fs, { existsSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from "fs"
|
import { existsSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from "fs"
|
||||||
import ScriptUtils from "./ScriptUtils"
|
import ScriptUtils from "./ScriptUtils"
|
||||||
import { Utils } from "../Utils"
|
import { Utils } from "../Utils"
|
||||||
import Script from "./Script"
|
import Script from "./Script"
|
||||||
|
@ -56,9 +56,9 @@ class StatsDownloader {
|
||||||
}.day.json`
|
}.day.json`
|
||||||
writtenFiles.push(path)
|
writtenFiles.push(path)
|
||||||
if (existsSync(path)) {
|
if (existsSync(path)) {
|
||||||
let features = JSON.parse(readFileSync(path, { encoding: "utf-8" }))
|
let loadedFeatures = JSON.parse(readFileSync(path, { encoding: "utf-8" }))
|
||||||
features = features?.features ?? features
|
loadedFeatures = loadedFeatures?.features ?? loadedFeatures
|
||||||
features.push(...features.features) // day-stats are generally a list already, but in some ad-hoc cases might be a geojson-collection too
|
features.push(...loadedFeatures) // day-stats are generally a list already, but in some ad-hoc cases might be a geojson-collection too
|
||||||
console.log(
|
console.log(
|
||||||
"Loaded ",
|
"Loaded ",
|
||||||
path,
|
path,
|
||||||
|
@ -296,7 +296,7 @@ class GenerateSeries extends Script {
|
||||||
features.forEach((f) => {
|
features.forEach((f) => {
|
||||||
delete f.bbox
|
delete f.bbox
|
||||||
})
|
})
|
||||||
fs.writeFileSync(
|
writeFileSync(
|
||||||
path,
|
path,
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue