From be452eb7d92eacf1d94481cbdafdfb9e50a73211 Mon Sep 17 00:00:00 2001 From: Marc Shade Date: Tue, 24 Feb 2026 10:44:08 -0500 Subject: [PATCH] fix: wildfire counter shows cluster count, cable corridor antimeridian split Wildfire sidebar counter now shows rendered cluster markers (180) instead of raw FIRMS detections (74,901); raw total preserved in tooltip. Transpacific cable corridor rectangle split into two halves at the antimeridian so it renders over the Pacific instead of across landmasses. Co-Authored-By: Claude Opus 4.6 --- src/world_intel_mcp/dashboard/index.html | 28 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/world_intel_mcp/dashboard/index.html b/src/world_intel_mcp/dashboard/index.html index d4bade2..658d156 100644 --- a/src/world_intel_mcp/dashboard/index.html +++ b/src/world_intel_mcp/dashboard/index.html @@ -1035,7 +1035,10 @@ function updateMapFires(data) { mk.addTo(mapLayers.fires); }); } - $('#cntFires').textContent = data.total_fires || total; + var clusterCount = mapLayers.fires.getLayers().length; + // Show cluster count for sidebar (what's on the map), full total in tooltip + $('#cntFires').textContent = clusterCount; + $('#cntFires').title = (data.total_fires || total) + ' individual fire detections'; } function updateMapConvergence(data) { @@ -1176,17 +1179,24 @@ function updateMapInfra(data) { }); // Submarine cable corridors (shaded rectangles) var cables = (data.cable_corridors && data.cable_corridors.corridors) || []; + var cableStyle = { color: '#4da8ff', weight: 1, opacity: 0.2, fillColor: '#4da8ff', fillOpacity: 0.04, dashArray: '4 3', className: 'cable-corridor' }; cables.forEach(function(c) { if (!c.lat_range || !c.lon_range) return; total++; - var bounds = [[c.lat_range[0], c.lon_range[0]], [c.lat_range[1], c.lon_range[1]]]; - var rect = L.rectangle(bounds, { - color: '#4da8ff', weight: 1, opacity: 0.2, - fillColor: '#4da8ff', fillOpacity: 0.04, - dashArray: '4 3', className: 'cable-corridor' - }); - rect.bindTooltip('' + esc(c.name.replace(/_/g, ' ')) + '
' + (c.cables || []).join(', ') + '', { className: 'mk-tip', sticky: true }); - rect.addTo(mapLayers.infra); + var tip = '' + esc(c.name.replace(/_/g, ' ')) + '
' + (c.cables || []).join(', ') + ''; + // Handle antimeridian crossing (lon_start > lon_end means wrapping past 180) + if (c.lon_range[0] > c.lon_range[1]) { + var r1 = L.rectangle([[c.lat_range[0], c.lon_range[0]], [c.lat_range[1], 180]], cableStyle); + var r2 = L.rectangle([[c.lat_range[0], -180], [c.lat_range[1], c.lon_range[1]]], cableStyle); + r1.bindTooltip(tip, { className: 'mk-tip', sticky: true }); + r2.bindTooltip(tip, { className: 'mk-tip', sticky: true }); + r1.addTo(mapLayers.infra); + r2.addTo(mapLayers.infra); + } else { + var rect = L.rectangle([[c.lat_range[0], c.lon_range[0]], [c.lat_range[1], c.lon_range[1]]], cableStyle); + rect.bindTooltip(tip, { className: 'mk-tip', sticky: true }); + rect.addTo(mapLayers.infra); + } }); $('#cntInfra').textContent = total; }