Base map theme switch: Maptool or NPS Park Tiles (colors sampled from the Park Tiles legend, park fill above landcover with a tint band), remembered; both themes in map_themes.js so /symbols.html draws a side-by-side map legend from the same patched style, linked from the Base map panel, which now stays even without offline tiles
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-18 23:11:44 +01:00
1 parent cb6412f0ba
commit f09216b102
8 files changed
+407 -170

No files matched your search

+13 -5
View File
@@ -111,7 +111,7 @@ snapshot under `public/vendor/liberty-sprite/` — both `offlineStyle()`
and the online style otherwise share identical `glyphs`/`sprite`
roles, just resolved to local vs. `tiles.openfreemap.org` URLs.
`public/js/map.js`'s `ONLINE_STYLE_PATCH` — applied to whichever
`public/js/map_themes.js`'s `ONLINE_STYLE_PATCH` — applied to whichever
source is loaded, online or offline (see above) — nudges Liberty's
OpenMapTiles layer ids towards a warm, National Park Service
"Park Tiles"-inspired look. A few of these values are the genuine
@@ -137,11 +137,19 @@ labeling prioritized), not general-purpose worldwide cartography —
irrelevant to this app either way now, since it never talks to NPS's
tile service, only ever OpenFreeMap/Geofabrik.
A second theme, *NPS Park Tiles* (Base map panel → Theme, remembered in
`localStorage`), is a closer take on Park Tiles' Standard style:
`PARK_TILES_PATCH` in the same file, colors sampled from the Park Tiles
legend swatches (see `docs/nps-resources.adoc`), and the park fill moved
above landcover with a tint band inside its boundary line. Both themes
live in `public/js/map_themes.js` so `/symbols.html` can draw its map
legend from the very same patched style the map uses.
`loadOnlineStyle` (`public/js/map.js`) fetches Liberty's live
`style.json` once, patches it in place, and uses the resulting object
everywhere `ONLINE_STYLE` used to be a plain URL string — MapLibre
accepts a style object anywhere it accepts a style URL, so
`applyStyle`'s `map.setStyle(... : ONLINE_STYLE)` needed no change.
`style.json` once and keeps it unpatched as `ONLINE_STYLE_TEMPLATE`;
`onlineStyle(theme)` patches a fresh copy for whichever theme is
selected — MapLibre accepts a style object anywhere it accepts a style
URL, so `applyStyle`'s `map.setStyle` takes either.
That fetch runs before the map (and the rest of the page) is
constructed — a top-level `await` — so there's no flash of Liberty's
own colors before the patch lands; a 3s timeout and a catch-all fall