Lower offline terrain to z13, not z15 — raster DEM storage explodes with zoom
CI / check (push) Failing after 4s
CI / deploy (push) Skipped

The 12-country selection's terrain.pmtiles was headed well past the
181GB an earlier 5-country build already produced at z15. Raster DEM
tiles don't compress away like vector ones (every tile is a real
image, even over empty terrain), so each extra zoom level roughly
quadruples storage. z13 is each Mapterhorn regional chunk's own native
minzoom — one raster level per chunk instead of a 15-13=2-level
pyramid on top — still enough for the hillshade toggle and the planned
slope readout. Online hillshade keeps its own z15 cap; this only
affects the offline copy.
This commit is contained in:
randy committed 2026-09-12 20:18:36 +02:00
1 parent f18e5c19d3
commit 21988c61da
2 files changed
+19 -7

No files matched your search

+10 -2
View File
@@ -71,10 +71,10 @@ and similar, varying by region):
[source,shell] [source,shell]
---- ----
pmtiles extract https://download.mapterhorn.com/planet.pmtiles planet-extract.pmtiles --bbox=west,south,east,north --maxzoom=15 --overfetch=0 pmtiles extract https://download.mapterhorn.com/planet.pmtiles planet-extract.pmtiles --bbox=west,south,east,north --maxzoom=13 --overfetch=0
# only if a regional chunk covers the bbox too (see download_urls.json) — # only if a regional chunk covers the bbox too (see download_urls.json) —
# most bboxes hit exactly one, a bbox straddling a chunk boundary hits two: # most bboxes hit exactly one, a bbox straddling a chunk boundary hits two:
pmtiles extract https://download.mapterhorn.com/<chunk>.pmtiles chunk-extract.pmtiles --bbox=west,south,east,north --maxzoom=15 --overfetch=0 pmtiles extract https://download.mapterhorn.com/<chunk>.pmtiles chunk-extract.pmtiles --bbox=west,south,east,north --maxzoom=13 --overfetch=0
pmtiles merge planet-extract.pmtiles chunk-extract.pmtiles data/terrain.pmtiles pmtiles merge planet-extract.pmtiles chunk-extract.pmtiles data/terrain.pmtiles
---- ----
@@ -88,6 +88,14 @@ fragile mega-request for many small ones instead (spread over
connection only loses one small request's worth of progress, not the connection only loses one small request's worth of progress, not the
whole extract. whole extract.
`--maxzoom=13`: raster DEM tiles don't compress away like vector ones do
(every tile is a real image, even over flat/empty terrain), so each extra
zoom level roughly quadruples storage — the app's own build
(`PmtilesBuilder::TERRAIN_MAX_ZOOM`) caps at 13, each regional chunk's
own native minzoom, rather than the online hillshade layer's z15. A
12-country selection at z15 was headed well past 181GB; z13 is still
plenty for the hillshade toggle and the planned slope readout.
Tiles are 512px WebP, not the 256px PNG this app's *online* Terrarium Tiles are 512px WebP, not the 256px PNG this app's *online* Terrarium
source uses — `public/js/dem.js`'s own point-elevation lookups source uses — `public/js/dem.js`'s own point-elevation lookups
(`shadow.js`'s terrain-shadow overlay) read the actual decoded tile (`shadow.js`'s terrain-shadow overlay) read the actual decoded tile
+9 -5
View File
@@ -88,11 +88,15 @@ module Maptool
# archive" story via go-pmtiles, unrelated to the basemap swap. # archive" story via go-pmtiles, unrelated to the basemap swap.
MAPTERHORN_MANIFEST_URL = "https://download.mapterhorn.com/download_urls.json" MAPTERHORN_MANIFEST_URL = "https://download.mapterhorn.com/download_urls.json"
MAPTERHORN_PLANET_NAME = "planet.pmtiles" MAPTERHORN_PLANET_NAME = "planet.pmtiles"
# Matches the online hillshade layer's own cap (public/js/overlays.js's # Deliberately *below* the online hillshade layer's own cap
# ONLINE_TERRAIN_TILES source, maxzoom: 15) — applied uniformly even # (public/js/overlays.js's ONLINE_TERRAIN_TILES source, maxzoom: 15) —
# though some Mapterhorn chunks natively offer more, so the offline # raster DEM tiles don't compress away like vector ones do, so every
# experience doesn't vary in detail from one region to the next. # extra zoom level roughly quadruples storage. z13 is each regional
TERRAIN_MAX_ZOOM = 15 # chunk's own native minzoom (see the comment above), so this is the
# cheapest useful cut: one raster level per chunk, not a 15-13=2-level
# pyramid on top of it. Bumped into a 181GB terrain.pmtiles for a
# 5-country selection before this was lowered — see docs/development.adoc.
TERRAIN_MAX_ZOOM = 13
OFFLINE_STATUS = { state: "idle" } OFFLINE_STATUS = { state: "idle" }
TERRAIN_STATUS = { state: "idle" } TERRAIN_STATUS = { state: "idle" }