Replace offline basemap pipeline with Planetiler, unify online/offline styling
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 2m43s

Offline tiles were built from Protomaps' own basemap schema, needing a
completely separate hand-tuned theme (protomaps-themes-base + OFFLINE_THEME)
from the online Liberty style's ONLINE_STYLE_PATCH — the two could never be
made to match exactly no matter how much either side got tuned (today's
session found and fixed several mismatches: building opacity, park
boundaries, road casings, road widths).

Offline.pmtiles is now built with Planetiler's default OpenMapTiles profile
against Geofabrik per-country OSM extracts (osmium-merged when more than one
country is selected), the same vector schema Liberty already expects.
offlineStyle() now clones the same Liberty JSON (vendored as a local
snapshot for reliability with no internet) and applies the identical
ONLINE_STYLE_PATCH, just repointed at local PMTiles/glyphs/sprite — one
palette instead of two, correct on both sides by construction.

Also vendors Liberty's icon sprite for the first time (offline had none
before), adds Java/osmium-tool/planetiler.jar to the Docker image, and
removes the now-unused protomaps-themes-base dependency and the
theme-comparison debug page that found today's bugs.
This commit is contained in:
randy committed 2026-09-11 20:52:11 +02:00
1 parent 0874e8f8ed
commit d08ed41185
21 files changed
+4286 -512

No files matched your search

+41 -21
View File
@@ -18,10 +18,6 @@ BSD-3-Clause licensed.
| 4.5.0
| https://github.com/protomaps/PMTiles
| protomaps-themes-base
| 4.5.0
| https://github.com/protomaps/basemaps
| maplibre-contour (Overlays panel's "Contour lines", `public/js/contour.js`)
| 0.1.0
| https://github.com/onthegomap/maplibre-contour
@@ -91,38 +87,62 @@ for free use under the SIL Open Font License" per the site; no
`OFL.txt` ships in its own download zips, unlike Noto Sans above
|===
The online map style (not vendored, fetched at runtime when the
"Online" layer is selected) is
https://tiles.openfreemap.org/styles/liberty[OpenFreeMap "liberty"],
built from https://www.openstreetmap.org[OpenStreetMap] data.
The map style — https://tiles.openfreemap.org/styles/liberty[OpenFreeMap
"liberty"], built from https://www.openstreetmap.org[OpenStreetMap]
data — is used two ways (see `docs/architecture.adoc`): fetched live
at runtime for the "Online" layer, and as a one-time vendored snapshot
(`public/vendor/liberty-style/liberty.json`) that the "Offline" layer
repoints at local data instead. Its icon sprite is vendored the same
way, under `public/vendor/liberty-sprite/` (`ofm.json`/`ofm.png` +
`@2x` variants, from `tiles.openfreemap.org/sprites/`). Neither has
been re-checked against a specific upstream version pin the way the
table above does — re-fetch both from `tiles.openfreemap.org` if
Liberty's own style/sprite ever visibly drifts from what's vendored.
`terrain.pmtiles` (`lib/maptool/pmtiles_builder.rb`'s in-app
`data/offline.pmtiles` (`lib/maptool/pmtiles_builder.rb`'s in-app
regeneration, or the manual recipe in `docs/development.adoc`) is
extracted at build time, not vendored, from
https://mapterhorn.com[Mapterhorn] — a Protomaps-affiliated project
publishing pre-built Terrarium-encoded terrain as PMTiles. Per-region
source licenses vary (CC-BY-4.0 and similar); see
built at build time, not vendored, from
https://download.geofabrik.de[Geofabrik]'s per-country OpenStreetMap
extracts (ODbL).
`terrain.pmtiles` (same regeneration mechanism) is extracted at build
time, not vendored, from https://mapterhorn.com[Mapterhorn] — a
Protomaps-affiliated project publishing pre-built Terrarium-encoded
terrain as PMTiles. Per-region source licenses vary (CC-BY-4.0 and
similar); see
https://download.mapterhorn.com/attribution.json[their own attribution
list] for the full provenance.
Not a frontend asset like the above, but also baked into this app's own
Docker image (not a separate container the way kiwix-serve/gpsd are —
see `docs/deployment.adoc`/`docs/development.adoc`): the `pmtiles` CLI
(`go-pmtiles`), installed as a static binary in the `Dockerfile` for
`lib/maptool/pmtiles_builder.rb`'s in-app offline.pmtiles/terrain.pmtiles
regeneration. BSD-3-Clause, same as pmtiles.js/MapLibre GL above.
see `docs/deployment.adoc`/`docs/development.adoc`): three CLI tools
`lib/maptool/pmtiles_builder.rb` shells out to for offline.pmtiles/
terrain.pmtiles regeneration.
[cols="1,1,2"]
[cols="1,1,1,2"]
|===
| Tool | Version | Source
| Tool | Version | License | Source
| go-pmtiles (`pmtiles` CLI)
| 1.31.2
| BSD-3-Clause
| https://github.com/protomaps/go-pmtiles
| Planetiler (`planetiler.jar`)
| 0.10.2
| Apache-2.0
| https://github.com/onthegomap/planetiler
| osmium-tool (`osmium`, installed via the `osmium-tool` Debian package)
| (Debian bookworm's packaged version)
| GPL-3.0
| https://github.com/osmcode/osmium-tool
|===
To update a vendored library: download its package (e.g.
`npm pack <name>@<version>`), replace the corresponding files under
`public/vendor/<name>/`, and update the version in this file. To
update go-pmtiles, bump `PMTILES_VERSION` in the `Dockerfile` and the
version here.
update go-pmtiles or Planetiler, bump `PMTILES_VERSION`/
`PLANETILER_VERSION` in the `Dockerfile` and the version here —
osmium-tool tracks whatever version Debian bookworm currently packages,
nothing to pin on this side.