Weather alerts: simplify zone-resolved NWS polygons (payload ~2 MB for 3 states) #264

Open
opened 2026-10-05 02:55:20 -04:00 by logan · 0 comments
Owner

Found while building the #237 backend (PR #263).

/weather/alerts fills in polygons for zone-based NWS alerts (geometry: null) from api.weather.gov/zones/.... Those zone shapes are full-resolution, coastal ones especially. A live smoke test on 2026-10-05 with NWS_AREA=CA,FL,AK produced about 2.1 MB of alert JSON with no bbox filter. NY-only will be smaller, but a statewide winter event lists 100+ zones.

Options: simplify each zone polygon once when it enters the 24 h zone cache (Douglas-Peucker to around 0.005°, no new dependency), and/or make the frontend always pass the viewport bbox (the endpoint supports it already).

Also: MAX_ZONE_FETCHES_PER_REFRESH=80 means a cold cache with many zones resolves over several 90 s refreshes. Until then those alerts show in zone_only or with zones_unresolved>0. That is honest, but a first-load map can under-draw. Consider pre-warming the zone cache for NWS_AREA at startup.

Refs #237

Found while building the #237 backend (PR #263). `/weather/alerts` fills in polygons for zone-based NWS alerts (`geometry: null`) from `api.weather.gov/zones/...`. Those zone shapes are full-resolution, coastal ones especially. A live smoke test on 2026-10-05 with `NWS_AREA=CA,FL,AK` produced about **2.1 MB** of alert JSON with no bbox filter. NY-only will be smaller, but a statewide winter event lists 100+ zones. **Options:** simplify each zone polygon once when it enters the 24 h zone cache (Douglas-Peucker to around 0.005°, no new dependency), and/or make the frontend always pass the viewport bbox (the endpoint supports it already). **Also:** `MAX_ZONE_FETCHES_PER_REFRESH=80` means a cold cache with many zones resolves over several 90 s refreshes. Until then those alerts show in `zone_only` or with `zones_unresolved>0`. That is honest, but a first-load map can under-draw. Consider pre-warming the zone cache for `NWS_AREA` at startup. Refs #237
logan added the
type
feature
area/map
priority
p3
labels 2026-10-05 02:55:20 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: logan/server-26#264