Fix Planetiler tmp-file format detection, add build progress and delete
Root cause of "planetiler exited with status 1: ... Unsupported format
tmp" (and likely the earlier unexplained "pmtiles exited with status
1"): Planetiler/go-pmtiles pick their output archive format from the
file extension, and the atomic-rename tmp files were named
"offline.pmtiles.tmp"/"terrain.pmtiles.tmp" — ".tmp" as the extension,
not ".pmtiles". Renamed to "offline.tmp.pmtiles"/"terrain.tmp.pmtiles".
Also, since build-status only ever said "running since X" with no way
to tell what it was actually doing:
- GET .../build-status now includes a `step` string ("fetching PL
(3/4) — done: SK, CZ — pending: HU", "tiling with planetiler", ...)
while a build is in progress.
- DELETE /api/offline-tiles / /api/terrain-tiles clear a built file,
its sidecar meta, and (for offline) the whole per-country download
cache — a manual "reclaim space" / "start over" action the region
picker's Apply never did on its own. DELETE
/api/offline-tiles/cache/:code clears just one country's cached
extract. All three are 409 while that kind's build is running, and
surfaced as a small "Delete" button on each row in the Offline data
panel.
This commit is contained in:
1 parent
2878270187
commit
b54020e23b
7 files changed
+327
-23
No files matched your search
+20
-7
@@ -94,12 +94,11 @@ Ticking countries and clicking "Apply changes" saves the selection
|
||||
(`data/offline_regions.json`, an array of ISO A2 codes) and rebuilds
|
||||
both files to cover it.
|
||||
|
||||
There's no standalone per-country file to individually delete —
|
||||
`offline.pmtiles`/`terrain.pmtiles` are always one combined extract for
|
||||
the *whole current selection*. "Remove a country" and "refresh a
|
||||
country" are both just "change the selection, then Apply" (unticking a
|
||||
country and applying rebuilds without it; nothing to separately
|
||||
delete). terrain.pmtiles re-extracts its selection from scratch on
|
||||
There's no standalone per-country *built* file — `offline.pmtiles`/
|
||||
`terrain.pmtiles` are always one combined extract for the *whole
|
||||
current selection*. "Remove a country" is just "change the selection,
|
||||
then Apply" (unticking a country and applying rebuilds without it).
|
||||
terrain.pmtiles re-extracts its selection from scratch on
|
||||
every Apply — fine given that extraction is byte-range requests
|
||||
against a remote archive, not full downloads. offline.pmtiles, by
|
||||
contrast, downloads a whole country's `.osm.pbf` from Geofabrik (can be
|
||||
@@ -134,7 +133,21 @@ the current selection, `POST` to change it, then `POST
|
||||
/api/offline-tiles/build` / `/api/terrain-tiles/build`, polled via the
|
||||
matching `*/build-status` route) — only one of each kind at a time;
|
||||
starting a second while one's running gets a 409, as does starting
|
||||
either with nothing selected yet.
|
||||
either with nothing selected yet. While running, `build-status` also
|
||||
includes a `step` string (e.g. `"fetching PL (3/4) — done: SK, CZ —
|
||||
pending: HU"`, or `"tiling with planetiler"`) — see
|
||||
`PmtilesBuilder.run_job`'s `report_step`.
|
||||
|
||||
`DELETE /api/offline-tiles` removes offline.pmtiles, its sidecar meta,
|
||||
and the whole per-country download cache (`data/geofabrik_cache/`) —
|
||||
`DELETE /api/terrain-tiles` does the same for terrain.pmtiles. Both are
|
||||
a manual "reclaim the space" / "start over" action (409 while that
|
||||
kind's build is running), separate from the region picker's Apply,
|
||||
which only changes what a *future* build covers and never frees
|
||||
anything already on disk. `DELETE
|
||||
/api/offline-tiles/cache/:code` removes just one country's cached
|
||||
extract, e.g. to force a clean re-download of it without touching the
|
||||
rest of the cache.
|
||||
|
||||
Each successful build also writes a small sidecar (`offline.pmtiles.
|
||||
meta.json` — each source country's code/Geofabrik slug/Last-Modified;
|
||||
|
||||
Reference in new issue
Block a user