Previously every layer toggle triggered 21 fresh tile requests with the new layer in the URL — ~21 server-side SVG renders, plus the round-trip overhead. Even with the GridCache fix the server still spent real CPU generating thousands of <rect>s per tile, and the user felt it. Add /weather/cells: a single JSON endpoint returning every layer field for every cell in the requested viewport. The hook fetches once on mount, time change, or pan/zoom, caches the cells in memory, and paints them via L.svgOverlay. Layer switches now re-color the same cached cells locally — zero network, zero server CPU. The single SVG uses lat/lon coords with preserveAspectRatio="none"; Leaflet stretches it linearly to the bbox. There is mild equirect→ mercator distortion at low zoom over CONUS but it's imperceptible at typical use (z6+) and the layer-toggle UX win is large. Tile endpoint kept for back-compat. svgOverlay opacity matches the prior tile renderer's 0.55 fill-opacity. |
||
|---|---|---|
| .. | ||
| microwaveprop | ||
| microwaveprop_web | ||
| mix/tasks | ||
| microwaveprop.ex | ||
| microwaveprop_web.ex | ||