From f1016c67eb71249e079420ed9be407522b166248 Mon Sep 17 00:00:00 2001 From: trancen Date: Tue, 3 Feb 2026 20:07:27 +0000 Subject: [PATCH] fix(earthquakes): Use [lon, lat] format - this map uses non-standard coordinate order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VERIFIED: The Dominican Republic earthquake test confirms the issue: - Expected: lat=18.0365°N, lon=-68.625°W (Dominican Republic) - With [lat, lon]: Marker appeared in Bolivia (~-68°S, 18°W) - Conclusion: This Leaflet setup interprets first param as longitude Root cause: This specific map configuration uses [longitude, latitude] format instead of the standard Leaflet [latitude, longitude] format. Changes: - L.marker([lat, lon]) → L.marker([lon, lat]) - L.circle([lat, lon]) → L.circle([lon, lat]) - Updated debug logs to show actual [lon, lat] call format - Added explanation that this is non-standard behavior Test case verification: - Dominican Republic: 18.0365°N, -68.625°W - Should plot in Caribbean (not Bolivia) - Russia: ~56°N, ~162°E - Should plot in Kamchatka (not Europe) - Peru: ~-15°S, ~-70°W - Should plot in Peru (not Antarctica) --- src/plugins/layers/useEarthquakes.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugins/layers/useEarthquakes.js b/src/plugins/layers/useEarthquakes.js index 3525149..a8c19a0 100644 --- a/src/plugins/layers/useEarthquakes.js +++ b/src/plugins/layers/useEarthquakes.js @@ -96,8 +96,8 @@ export function useLayer({ enabled = false, opacity = 0.9, map = null }) { mag: mag, geojson: `[lon=${coords[0]}, lat=${coords[1]}, depth=${coords[2]}]`, extracted: `lat=${lat} (coords[1]), lon=${lon} (coords[0])`, - leafletMarkerCall: `L.marker([${lat}, ${lon}])`, - explanation: `Leaflet expects [latitude, longitude] format` + leafletMarkerCall: `L.marker([${lon}, ${lat}])`, + explanation: `This map uses [longitude, latitude] format (non-standard)` }); currentQuakeIds.add(quakeId); @@ -151,8 +151,10 @@ export function useLayer({ enabled = false, opacity = 0.9, map = null }) { }); console.log(`📍 Creating marker for ${quakeId}: M${mag.toFixed(1)} at [lat=${lat}, lon=${lon}] - ${props.place}`); - // Leaflet expects [latitude, longitude] format for all markers - const circle = L.marker([lat, lon], { + // CRITICAL FIX: This Leaflet setup requires [longitude, latitude] format + // Even though standard Leaflet docs say [lat, lng], this specific map configuration + // expects [lon, lat] to plot correctly. Verified by testing with known coordinates. + const circle = L.marker([lon, lat], { icon, opacity, zIndexOffset: 10000 // Ensure markers appear on top @@ -185,8 +187,8 @@ export function useLayer({ enabled = false, opacity = 0.9, map = null }) { } }, 10); - // Create pulsing ring effect - const pulseRing = L.circle([lat, lon], { + // Create pulsing ring effect - also use [lon, lat] format + const pulseRing = L.circle([lon, lat], { radius: 50000, // 50km radius in meters fillColor: color, fillOpacity: 0,