feat: toggleable live map feeds (ADS-B, trains, AIS, radar, WFIGS, NWS)

Wire the free data streams from docs/free-data-streams.md into the
dashboard as layer-panel toggles. Third-party APIs are proxied/cached
in FastAPI; raster tiles (IEM, RainViewer, GIBS) stay in the browser.

- Aircraft via ADSB.lol viewport poll (bbox required, radius ≤ 150 nm)
- Amtraker trains, NHC storms, WFIGS incidents/perimeters
- NWS + IEM SBW as /api/weather-alerts (does not collide with /api/alerts)
- AISStream worker is server-side only and idles without AISSTREAM_API_KEY
- Caltrans CWWP2 D1–D12 camera parser; FIRMS dual-write NOAA-20/21
This commit is contained in:
Sirius DevOps 2026-08-27 19:08:30 -04:00
commit f779b1f225
15 changed files with 1662 additions and 39 deletions

View file

@ -34,6 +34,7 @@ import nats
from config import (
FIRMS_BBOX,
FIRMS_DATASET,
FIRMS_DATASETS,
FIRMS_DAYS,
FIRMS_TIMEOUT,
NATS_URL,
@ -180,26 +181,30 @@ async def ingest_fires(bbox: str | None = None) -> int:
return 0
area = bbox or FIRMS_BBOX
url = FIRMS_AREA_CSV.format(
key=map_key, dataset=FIRMS_DATASET, bbox=area, days=FIRMS_DAYS
)
datasets = FIRMS_DATASETS or [FIRMS_DATASET]
total_published = 0
async with httpx.AsyncClient(timeout=FIRMS_TIMEOUT) as client:
resp = await client.get(url)
resp.raise_for_status()
text = resp.text
# FIRMS returns HTTP 200 with a plain-text error for some failure modes
# (bad key, invalid bbox); surface the first line for debuggability.
if "latitude" not in text.lower()[:4096]:
first_line = text.strip().splitlines()[0][:200] if text.strip() else "(empty)"
logger.warning("FIRMS CSV download returned no hotspot data (%s)", first_line)
return 0
points = parse_firms_csv(text)
published = await publish_fire_batch(points)
logger.info(
"FIRMS: fetched %d hotspot(s) for bbox=%s (%s), published %d",
len(points), area, FIRMS_DATASET, published,
)
return published
for dataset in datasets:
url = FIRMS_AREA_CSV.format(
key=map_key, dataset=dataset, bbox=area, days=FIRMS_DAYS
)
resp = await client.get(url)
resp.raise_for_status()
text = resp.text
# FIRMS returns HTTP 200 with a plain-text error for some failure modes
# (bad key, invalid bbox); surface the first line for debuggability.
if "latitude" not in text.lower()[:4096]:
first_line = text.strip().splitlines()[0][:200] if text.strip() else "(empty)"
logger.warning(
"FIRMS CSV download returned no hotspot data for %s (%s)",
dataset, first_line,
)
continue
points = parse_firms_csv(text)
published = await publish_fire_batch(points)
total_published += published
logger.info(
"FIRMS: fetched %d hotspot(s) for bbox=%s (%s), published %d",
len(points), area, dataset, published,
)
return total_published