fix: refine treemap sizing and add earth bgp collectors

This commit is contained in:
linkong
2026-03-27 16:35:40 +08:00
parent 62f2d9f403
commit 7a3ca6e1b3
11 changed files with 741 additions and 49 deletions

View File

@@ -328,6 +328,29 @@ def convert_bgp_anomalies_to_geojson(records: List[BGPAnomaly]) -> Dict[str, Any
return {"type": "FeatureCollection", "features": features}
def convert_bgp_collectors_to_geojson() -> Dict[str, Any]:
features = []
for collector, location in sorted(RIPE_RIS_COLLECTOR_COORDS.items()):
features.append(
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [location["longitude"], location["latitude"]],
},
"properties": {
"collector": collector,
"city": location.get("city"),
"country": location.get("country"),
"status": "online",
},
}
)
return {"type": "FeatureCollection", "features": features}
# ============== API Endpoints ==============
@@ -553,6 +576,12 @@ async def get_bgp_anomalies_geojson(
return {**geojson, "count": len(geojson.get("features", []))}
@router.get("/geo/bgp-collectors")
async def get_bgp_collectors_geojson():
geojson = convert_bgp_collectors_to_geojson()
return {**geojson, "count": len(geojson.get("features", []))}
@router.get("/all")
async def get_all_visualization_data(db: AsyncSession = Depends(get_db)):
"""获取所有可视化数据的统一端点