forked from MapComplete/MapComplete
Feature(offline): prioritize generating europe
This commit is contained in:
parent
55ef862027
commit
b6f21a795f
1 changed files with 20 additions and 12 deletions
|
@ -38,21 +38,29 @@ class GeneratePmTilesExtracts extends Script {
|
|||
return this.startProcess(`extract planet-latest.pmtiles --download-threads=1 --minzoom=${z}${maxzoomflag} --bbox=${[min_lon, min_lat + 0.0001, max_lon, max_lat].join(",")} ${this.getFilename(z, x, y)}`)
|
||||
}
|
||||
|
||||
private* generateColumnIfNeeded(z: number, x: number, boundary: number, maxzoom?: number): Generator<Promise<void>> {
|
||||
const lastFileForColumn = this.getFilename(z, x, boundary - 1)
|
||||
if (existsSync(this.targetDir + "/" + lastFileForColumn)) {
|
||||
// Skip this column, already exists
|
||||
console.log("Skipping column ", x, "at zoom", z)
|
||||
this.skipped += boundary
|
||||
return
|
||||
}
|
||||
console.log("Starting column", x, "at zoom", z, "as", this.targetDir + "/" + lastFileForColumn, "does not exist")
|
||||
|
||||
for (let y = 0; y < boundary; y++) {
|
||||
yield this.generateArchive(z, x, y, maxzoom)
|
||||
}
|
||||
}
|
||||
|
||||
private* generateField(z: number, maxzoom?: number): Generator<Promise<void>> {
|
||||
const boundary = 2 << (z - 1)
|
||||
for (let x = 0; x < boundary / 2; x++) {
|
||||
// We first generate starting from the meridian, as this will prioritize Europe, where the dev is based
|
||||
this.generateColumnIfNeeded(z, x, boundary, maxzoom)
|
||||
}
|
||||
for (let x = 0; x < boundary; x++) {
|
||||
const lastFileForColumn = this.getFilename(z, x, boundary - 1)
|
||||
if (existsSync(this.targetDir + "/" + lastFileForColumn)) {
|
||||
// Skip this column, already exists
|
||||
console.log("Skipping column ", x, "at zoom", z)
|
||||
this.skipped += boundary
|
||||
continue
|
||||
}
|
||||
console.log("Starting column", x, "at zoom", z, "as", this.targetDir + "/" + lastFileForColumn, "does not exist")
|
||||
|
||||
for (let y = 0; y < boundary; y++) {
|
||||
yield this.generateArchive(z, x, y, maxzoom)
|
||||
}
|
||||
this.generateColumnIfNeeded(z, x, boundary, maxzoom)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue