Apply the NPS-inspired palette to the online map too
ONLINE_STYLE_PATCH mirrors OFFLINE_THEME's color choices onto OpenFreeMap Liberty's OpenMapTiles layer ids (a separate hand-built table -- the two schemas share no layer names). loadOnlineStyle fetches Liberty's style.json once, patches it in place, and the result replaces the plain URL everywhere ONLINE_STYLE is used -- MapLibre accepts a style object anywhere it accepts a style URL, so applyStyle needed no change. Runs before the map (and the rest of the page) is constructed, so there's no flash of Liberty's own colors first -- but with a 3s timeout and a catch-all fallback to the plain URL, since this app is meant to keep working offline in the field and blocking startup on a remote style server would undermine that. Verified in a real browser: online map now visually matches the offline theme (cream ground, brown/khaki land cover, green parks, muted roads), no console errors, Online/Offline toggle still works.
This commit is contained in:
1 parent
24b6180c03
commit
ceaaa0bb92
3 files changed
+134
-3
No files matched your search
@@ -24,8 +24,8 @@ checking here before searching from zero next time.
|
||||
| MIT (per `package.json`); the whole `npmap5-plugins` repo is separately
|
||||
public domain as a US government work
|
||||
|
||||
| Park Tiles color palette (offline basemap theme)
|
||||
| `public/js/map.js`'s `OFFLINE_THEME`
|
||||
| Park Tiles color palette (offline + online basemap themes)
|
||||
| `public/js/map.js`'s `OFFLINE_THEME` and `ONLINE_STYLE_PATCH`
|
||||
| Colors only — see <<park-tiles>> for why the actual tile service isn't used
|
||||
|
||||
| `overview` (top-right minimap/inset control)
|
||||
|
||||
Reference in new issue
Block a user