Context
I'm serving the Open Waters Seamap (a MapLibre mapstyleJSON vector chart) in Freeboard-SK on a boat, where the internet link (4G/Starlink) is the scarce resource and the Signal K server is always on.
charts-plugin already supports mapstyleJSON online providers and a "Proxy through Signal K server" option that fetches and caches remote tiles for offline use — great feature. But the proxy help text notes it is:
Only meaningful for tilelayer / WMS / WMTS providers; mapstyleJSON and tileJSON providers describe style/source manifests and have no per-tile cache to seed.
So for a mapstyleJSON chart nothing is cached: every pan/zoom re-fetches the vector tiles, sprites and glyphs from the remote host(s) — the exact problem the proxy already solves for raster/WMS.
Why it matters / the logic
A mapstyleJSON is a manifest, true — but the resources it references are very cacheable and are what actually cost the bandwidth:
- vector tiles (
.pbf) from each source (via its TileJSON tiles template),
- the sprite sheet + JSON,
- the glyph PBFs,
often spread across more than one host (Open Waters uses tiles.openwaters.io and tiles.versatiles.org).
On a boat this is the difference between "re-panning a zone you've already viewed hits the internet again" and "served instantly from the server, and available offline for visited areas." Same value as the existing raster/WMS proxy, one layer up.
What we have working
We built a small source-agnostic caching reverse proxy (currently a standalone plugin serving Open Waters) that:
- rewrites every absolute
https://<host>/… URL in the served style and in the TileJSON / sprite JSON it then fetches to a local …/px/<host>/<path> route (leaving {z}/{x}/{y} templates intact so the client still fills them);
- fetches-through and stores on disk, with per-type TTLs (tiles/sprites/glyphs kept long with
If-None-Match revalidation; JSON short), serves a stale copy on upstream error (offline), and an LRU size cap;
- is not an open proxy: it only fetches hosts that appear in the styles it has actually served (an allow-list grown from the trusted chart graph); any other host — or an internal IP — is refused.
It's been running on our boat, panning/zooming Open Waters from cache.
Ask
Would you be open to extending "Proxy through Signal K server" to cover mapstyleJSON providers — i.e. proxy + cache the style's sources' tiles, plus its sprites and glyphs? Was the exclusion just "no single tile URL to seed", or is there a deeper reason I'm missing?
Happy to share the code or turn it into a PR if the approach is useful, or to align it with however you'd prefer it to work inside charts-plugin.
Context
I'm serving the Open Waters Seamap (a MapLibre
mapstyleJSONvector chart) in Freeboard-SK on a boat, where the internet link (4G/Starlink) is the scarce resource and the Signal K server is always on.charts-plugin already supports
mapstyleJSONonline providers and a "Proxy through Signal K server" option that fetches and caches remote tiles for offline use — great feature. But the proxy help text notes it is:So for a
mapstyleJSONchart nothing is cached: every pan/zoom re-fetches the vector tiles, sprites and glyphs from the remote host(s) — the exact problem the proxy already solves for raster/WMS.Why it matters / the logic
A
mapstyleJSONis a manifest, true — but the resources it references are very cacheable and are what actually cost the bandwidth:.pbf) from eachsource(via its TileJSONtilestemplate),often spread across more than one host (Open Waters uses
tiles.openwaters.ioandtiles.versatiles.org).On a boat this is the difference between "re-panning a zone you've already viewed hits the internet again" and "served instantly from the server, and available offline for visited areas." Same value as the existing raster/WMS proxy, one layer up.
What we have working
We built a small source-agnostic caching reverse proxy (currently a standalone plugin serving Open Waters) that:
https://<host>/…URL in the served style and in the TileJSON / sprite JSON it then fetches to a local…/px/<host>/<path>route (leaving{z}/{x}/{y}templates intact so the client still fills them);If-None-Matchrevalidation; JSON short), serves a stale copy on upstream error (offline), and an LRU size cap;It's been running on our boat, panning/zooming Open Waters from cache.
Ask
Would you be open to extending "Proxy through Signal K server" to cover
mapstyleJSONproviders — i.e. proxy + cache the style's sources' tiles, plus its sprites and glyphs? Was the exclusion just "no single tile URL to seed", or is there a deeper reason I'm missing?Happy to share the code or turn it into a PR if the approach is useful, or to align it with however you'd prefer it to work inside charts-plugin.