feat(map): chokepoint preset catalog + vessels ?src= filter
- GET /api/map/chokepoints: static five-strait fly-to catalog (Hormuz, Bab el-Mandeb, Suez, Malacca, Taiwan) with bbox/center/zoom/vesselapi. No VesselAPI calls; only Hormuz flags vesselapi=true. - GET /api/vessels?src=aisstream|vesselapi|all (default all) filters the union store by provider so a Hormuz view skips ~5k CONUS AISStream rows. - Tests: span validation of all five boxes, catalog 200 shape, src filter.
This commit is contained in:
parent
8498945549
commit
ef8b877d21
4 changed files with 208 additions and 2 deletions
|
|
@ -957,10 +957,16 @@ async def fetch_trains(bbox: str | None, limit: int = DEFAULT_LIMIT) -> list[dic
|
|||
return rows[:limit]
|
||||
|
||||
|
||||
async def fetch_vessels(bbox: str | None, limit: int = DEFAULT_LIMIT) -> list[dict]:
|
||||
async def fetch_vessels(
|
||||
bbox: str | None,
|
||||
limit: int = DEFAULT_LIMIT,
|
||||
src: str | None = None,
|
||||
) -> list[dict]:
|
||||
async with vessel_lock:
|
||||
rows = [dict(v) for v in vessel_last_known.values()
|
||||
if v.get("lat") is not None and v.get("lon") is not None]
|
||||
if src and src != "all":
|
||||
rows = [r for r in rows if (r.get("extra") or {}).get("src") == src]
|
||||
if bbox:
|
||||
minlon, minlat, maxlon, maxlat = parse_bbox(bbox)
|
||||
return filter_points_bbox(rows, minlon, minlat, maxlon, maxlat, limit)
|
||||
|
|
|
|||
Loading…
Reference in a new issue