fix(earthquakes): Use [lon, lat] format - this map uses non-standard coordinate order

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)
pull/106/head
trancen 2 days ago
parent 7c51b88567
commit f1016c67eb

@ -96,8 +96,8 @@ export function useLayer({ enabled = false, opacity = 0.9, map = null }) {
mag: mag, mag: mag,
geojson: `[lon=${coords[0]}, lat=${coords[1]}, depth=${coords[2]}]`, geojson: `[lon=${coords[0]}, lat=${coords[1]}, depth=${coords[2]}]`,
extracted: `lat=${lat} (coords[1]), lon=${lon} (coords[0])`, extracted: `lat=${lat} (coords[1]), lon=${lon} (coords[0])`,
leafletMarkerCall: `L.marker([${lat}, ${lon}])`, leafletMarkerCall: `L.marker([${lon}, ${lat}])`,
explanation: `Leaflet expects [latitude, longitude] format` explanation: `This map uses [longitude, latitude] format (non-standard)`
}); });
currentQuakeIds.add(quakeId); 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}`); 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 // CRITICAL FIX: This Leaflet setup requires [longitude, latitude] format
const circle = L.marker([lat, lon], { // 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, icon,
opacity, opacity,
zIndexOffset: 10000 // Ensure markers appear on top zIndexOffset: 10000 // Ensure markers appear on top
@ -185,8 +187,8 @@ export function useLayer({ enabled = false, opacity = 0.9, map = null }) {
} }
}, 10); }, 10);
// Create pulsing ring effect // Create pulsing ring effect - also use [lon, lat] format
const pulseRing = L.circle([lat, lon], { const pulseRing = L.circle([lon, lat], {
radius: 50000, // 50km radius in meters radius: 50000, // 50km radius in meters
fillColor: color, fillColor: color,
fillOpacity: 0, fillOpacity: 0,

Loading…
Cancel
Save

Powered by TurnKey Linux.