feat: add FIRMS thermal, space weather, radiation, and internet outage layers

Add 4 new intelligence layers for v0.5:
- NASA FIRMS VIIRS thermal anomaly tiles (frontend-only WMTS)
- NOAA Space Weather Kp index badge in bottom bar
- Safecast radiation monitoring with clustered markers
- IODA internet outage alerts at country centroids

All use free keyless APIs. All layers default to off.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
anoracleofra-code
2026-03-10 09:01:35 -06:00
parent c4de39bb02
commit 7cb926e227
5 changed files with 266 additions and 4 deletions
+18
View File
@@ -146,6 +146,9 @@ export default function Dashboard() {
gibs_imagery: false,
highres_satellite: false,
kiwisdr: false,
firms: false,
radiation: false,
internet_outages: false,
});
// NASA GIBS satellite imagery state
@@ -511,6 +514,21 @@ export default function Dashboard() {
<div className="text-[8px] text-[var(--text-muted)] font-mono tracking-[0.2em]">STYLE</div>
<div className="text-[11px] text-cyan-400 font-mono font-bold">{activeStyle}</div>
</div>
{/* Divider */}
<div className="w-px h-8 bg-[var(--border-primary)]" />
{/* Space Weather */}
<div className="flex flex-col items-center" title={`Kp Index: ${data?.space_weather?.kp_index ?? 'N/A'}`}>
<div className="text-[8px] text-[var(--text-muted)] font-mono tracking-[0.2em]">SOLAR</div>
<div className={`text-[11px] font-mono font-bold ${
(data?.space_weather?.kp_index ?? 0) >= 5 ? 'text-red-400' :
(data?.space_weather?.kp_index ?? 0) >= 4 ? 'text-yellow-400' :
'text-green-400'
}`}>
{data?.space_weather?.kp_text || 'N/A'}
</div>
</div>
</div>
</motion.div>
</>
+128 -1
View File
@@ -411,6 +411,53 @@ const MaplibreViewer = ({ data, activeLayers, onEntityClick, flyToLocation, sele
};
}, [activeLayers.kiwisdr, data?.kiwisdr, inView]);
// Radiation monitors — green/red dots based on CPM level
const radiationGeoJSON = useMemo(() => {
if (!activeLayers.radiation || !data?.radiation?.length) return null;
return {
type: 'FeatureCollection' as const,
features: data.radiation.filter((r: any) => r.lat != null && r.lng != null).map((r: any, i: number) => ({
type: 'Feature' as const,
properties: { id: i, type: 'radiation', cpm: r.cpm || 0, captured_at: r.captured_at || '' },
geometry: { type: 'Point' as const, coordinates: [r.lng, r.lat] }
}))
};
}, [activeLayers.radiation, data?.radiation]);
// Internet outages — country centroids
const COUNTRY_CENTROIDS: Record<string, [number, number]> = {
'AF': [67.7, 33.9], 'AL': [20.2, 41.2], 'DZ': [1.7, 28.0], 'AO': [17.9, -11.2], 'AR': [-63.6, -38.4],
'AM': [45.0, 40.1], 'AU': [133.8, -25.3], 'AZ': [47.6, 40.1], 'BD': [90.4, 23.7], 'BY': [27.9, 53.7],
'BR': [-51.9, -14.2], 'MM': [96.0, 21.9], 'KH': [105.0, 12.6], 'CM': [12.4, 7.4], 'CA': [-106.3, 56.1],
'CF': [20.9, 6.6], 'TD': [18.7, 15.5], 'CL': [-71.5, -35.7], 'CN': [104.2, 35.9], 'CO': [-74.3, 4.6],
'CD': [21.8, -4.0], 'CU': [-77.8, 21.5], 'EG': [30.8, 26.8], 'ET': [40.5, 9.1], 'FR': [2.2, 46.2],
'DE': [10.5, 51.2], 'GH': [-1.0, 7.9], 'GR': [21.8, 39.1], 'HT': [-72.3, 19.1], 'IN': [78.9, 20.6],
'ID': [113.9, -0.8], 'IR': [53.7, 32.4], 'IQ': [43.7, 33.2], 'IL': [34.9, 31.0], 'IT': [12.6, 41.9],
'JP': [138.3, 36.2], 'JO': [36.2, 30.6], 'KZ': [67.0, 48.0], 'KE': [37.9, -0.0], 'KP': [127.5, 40.3],
'KR': [128.0, 35.9], 'KW': [47.5, 29.3], 'LB': [35.9, 33.9], 'LY': [17.2, 26.3], 'MX': [-102.6, 23.6],
'MA': [-7.1, 31.8], 'MZ': [35.5, -18.7], 'NG': [8.7, 9.1], 'PK': [69.3, 30.4], 'PS': [35.2, 31.9],
'PH': [122.0, 12.9], 'PL': [19.1, 51.9], 'RU': [105.3, 61.5], 'SA': [45.1, 23.9], 'SD': [30.2, 12.9],
'SO': [46.2, 5.2], 'ZA': [22.9, -30.6], 'SS': [31.3, 6.9], 'SY': [38.0, 35.0], 'TW': [121.0, 23.7],
'TZ': [34.9, -6.4], 'TH': [100.5, 15.9], 'TR': [35.2, 38.9], 'UA': [31.2, 48.4], 'AE': [53.8, 23.4],
'GB': [-3.4, 55.4], 'US': [-98.5, 39.8], 'UZ': [64.6, 41.4], 'VE': [-66.6, 6.4], 'VN': [108.3, 14.1],
'YE': [48.5, 15.6], 'ZW': [29.2, -19.0],
};
const internetOutagesGeoJSON = useMemo(() => {
if (!activeLayers.internet_outages || !data?.internet_outages?.length) return null;
return {
type: 'FeatureCollection' as const,
features: data.internet_outages.map((o: any) => {
const coords = COUNTRY_CENTROIDS[o.country_code];
if (!coords) return null;
return {
type: 'Feature' as const,
properties: { country: o.country_name, level: o.level, score: o.score || 0 },
geometry: { type: 'Point' as const, coordinates: coords }
};
}).filter(Boolean)
};
}, [activeLayers.internet_outages, data?.internet_outages]);
// Load Images into the Map Style once loaded
const onMapLoad = useCallback((e: any) => {
const map = e.target;
@@ -1145,7 +1192,9 @@ const MaplibreViewer = ({ data, activeLayers, onEntityClick, flyToLocation, sele
earthquakesGeoJSON && 'earthquakes-layer',
satellitesGeoJSON && 'satellites-layer',
cctvGeoJSON && 'cctv-layer',
kiwisdrGeoJSON && 'kiwisdr-layer'
kiwisdrGeoJSON && 'kiwisdr-layer',
radiationGeoJSON && 'radiation-layer',
internetOutagesGeoJSON && 'internet-outages-layer'
].filter(Boolean) as string[];
@@ -1249,6 +1298,27 @@ const MaplibreViewer = ({ data, activeLayers, onEntityClick, flyToLocation, sele
</Source>
)}
{/* NASA FIRMS VIIRS — thermal anomalies / wildfires overlay */}
{activeLayers.firms && gibsDate && (
<Source
key={`firms-${gibsDate}`}
id="firms-viirs"
type="raster"
tiles={[`https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_NOAA20_Thermal_Anomalies_375m_All/default/${gibsDate}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.png`]}
tileSize={256}
maxzoom={9}
>
<Layer
id="firms-viirs-layer"
type="raster"
paint={{
'raster-opacity': 0.9,
'raster-fade-duration': 300
}}
/>
</Source>
)}
{/* SOLAR TERMINATOR — night overlay */}
{activeLayers.day_night && nightGeoJSON && (
<Source id="night-overlay" type="geojson" data={nightGeoJSON as any}>
@@ -1906,6 +1976,63 @@ const MaplibreViewer = ({ data, activeLayers, onEntityClick, flyToLocation, sele
</Source>
)}
{/* Radiation Monitors — green/red clustered dots */}
{radiationGeoJSON && (
<Source id="radiation" type="geojson" data={radiationGeoJSON as any} cluster={true} clusterRadius={50} clusterMaxZoom={12}>
<Layer
id="radiation-clusters"
type="circle"
filter={['has', 'point_count']}
paint={{
'circle-color': 'rgba(0, 255, 100, 0.7)',
'circle-radius': ['step', ['get', 'point_count'], 10, 5, 14, 10, 18],
'circle-stroke-width': 1,
'circle-stroke-color': 'rgba(0, 255, 100, 1.0)'
}}
/>
<Layer
id="radiation-cluster-count"
type="symbol"
filter={['has', 'point_count']}
layout={{ 'text-field': '{point_count_abbreviated}', 'text-size': 10, 'text-allow-overlap': true }}
paint={{ 'text-color': '#ffffff', 'text-halo-color': '#000000', 'text-halo-width': 1 }}
/>
<Layer
id="radiation-layer"
type="circle"
filter={['!', ['has', 'point_count']]}
paint={{
'circle-radius': 5,
'circle-color': ['case', ['>', ['get', 'cpm'], 100], '#ff2222', '#00ff66'],
'circle-stroke-width': 1,
'circle-stroke-color': ['case', ['>', ['get', 'cpm'], 100], '#ff4444', '#00cc55'],
'circle-opacity': 0.8
}}
/>
</Source>
)}
{/* Internet Outages — country-level markers */}
{internetOutagesGeoJSON && (
<Source id="internet-outages" type="geojson" data={internetOutagesGeoJSON as any}>
<Layer
id="internet-outages-layer"
type="circle"
paint={{
'circle-radius': 12,
'circle-color': ['case',
['>=', ['get', 'score'], 80], '#ff0040',
['>=', ['get', 'score'], 50], '#ff6600',
'#888888'
],
'circle-stroke-width': 2,
'circle-stroke-color': '#ffffff',
'circle-opacity': 0.8
}}
/>
</Source>
)}
{/* Satellite positions — mission-type icons */}
{satellitesGeoJSON && (
<Source id="satellites" type="geojson" data={satellitesGeoJSON as any}>
@@ -2,7 +2,7 @@
import React, { useState, useEffect, useRef } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { Plane, AlertTriangle, Activity, Satellite, Cctv, ChevronDown, ChevronUp, Ship, Eye, Anchor, Settings, Sun, Moon, BookOpen, Radio, Play, Pause, Globe } from "lucide-react";
import { Plane, AlertTriangle, Activity, Satellite, Cctv, ChevronDown, ChevronUp, Ship, Eye, Anchor, Settings, Sun, Moon, BookOpen, Radio, Play, Pause, Globe, Flame, Wifi } from "lucide-react";
import { useTheme } from "@/lib/ThemeContext";
const WorldviewLeftPanel = React.memo(function WorldviewLeftPanel({ data, activeLayers, setActiveLayers, onSettingsClick, onLegendClick, gibsDate, setGibsDate, gibsOpacity, setGibsOpacity }: { data: any; activeLayers: any; setActiveLayers: any; onSettingsClick?: () => void; onLegendClick?: () => void; gibsDate?: string; setGibsDate?: (d: string) => void; gibsOpacity?: number; setGibsOpacity?: (o: number) => void }) {
@@ -58,6 +58,9 @@ const WorldviewLeftPanel = React.memo(function WorldviewLeftPanel({ data, active
{ id: "gibs_imagery", name: "MODIS Terra (Daily)", source: "NASA GIBS", count: null, icon: Globe },
{ id: "highres_satellite", name: "High-Res Satellite", source: "Esri World Imagery", count: null, icon: Satellite },
{ id: "kiwisdr", name: "KiwiSDR Receivers", source: "KiwiSDR.com", count: data?.kiwisdr?.length || 0, icon: Radio },
{ id: "firms", name: "Thermal Anomalies", source: "NASA FIRMS VIIRS", count: null, icon: Flame },
{ id: "radiation", name: "Radiation Monitors", source: "Safecast CC0", count: data?.radiation?.length || 0, icon: Activity },
{ id: "internet_outages", name: "Internet Outages", source: "IODA / Georgia Tech", count: data?.internet_outages?.length || 0, icon: Wifi },
{ id: "day_night", name: "Day / Night Cycle", source: "Solar Calc", count: null, icon: Sun },
];