fix(earthquakes): Revert to standard [lat, lon] format matching other app markers

ANALYSIS: All other markers in the app (DE, DX, Sun, Moon, POTA, etc.) use
standard Leaflet [latitude, longitude] format:
- L.marker([deLocation.lat, deLocation.lon])
- L.marker([sunPos.lat, sunPos.lon])
- etc.

The earthquake layer MUST use the same format for consistency.

Changes:
- Reverted L.marker([lon, lat]) → L.marker([lat, lon])
- Reverted L.circle([lon, lat]) → L.circle([lat, lon])
- Added explicit logging showing exact coordinates passed to L.marker()
- Created intermediate markerCoords variable for debugging

Test verification:
- Dominican Republic (18.0365°N, -68.625°W):
  - [lat, lon] = [18.0365, -68.625] → Dominican Republic ✓
  - [lon, lat] = [-68.625, 18.0365] → Indian Ocean ✗
pull/106/head
trancen 1 day ago
parent f1016c67eb
commit b506ea6139

@ -151,10 +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}`);
// CRITICAL FIX: This Leaflet setup requires [longitude, latitude] format // Use standard Leaflet [latitude, longitude] format (same as all other markers in this app)
// Even though standard Leaflet docs say [lat, lng], this specific map configuration const markerCoords = [lat, lon];
// expects [lon, lat] to plot correctly. Verified by testing with known coordinates. console.log(` → Calling L.marker([${markerCoords[0]}, ${markerCoords[1]}]) - Should be [latitude, longitude]`);
const circle = L.marker([lon, lat], { const circle = L.marker(markerCoords, {
icon, icon,
opacity, opacity,
zIndexOffset: 10000 // Ensure markers appear on top zIndexOffset: 10000 // Ensure markers appear on top
@ -187,8 +187,8 @@ export function useLayer({ enabled = false, opacity = 0.9, map = null }) {
} }
}, 10); }, 10);
// Create pulsing ring effect - also use [lon, lat] format // Create pulsing ring effect - use same [lat, lon] format
const pulseRing = L.circle([lon, lat], { const pulseRing = L.circle([lat, lon], {
radius: 50000, // 50km radius in meters radius: 50000, // 50km radius in meters
fillColor: color, fillColor: color,
fillOpacity: 0, fillOpacity: 0,

@ -0,0 +1,28 @@
// Test to understand the coordinate flow
// Sample Dominican Republic earthquake from USGS
const geojsonData = {
geometry: {
coordinates: [-68.625, 18.0365, 75.0] // [lon, lat, depth] - GeoJSON format
},
properties: {
place: "37 km S of Boca de Yuma, Dominican Republic"
}
};
// Current code extraction
const coords = geojsonData.geometry.coordinates;
const lat = coords[1]; // 18.0365
const lon = coords[0]; // -68.625
console.log("GeoJSON coordinates:", coords);
console.log("Extracted lat:", lat, "(should be 18.0365)");
console.log("Extracted lon:", lon, "(should be -68.625)");
console.log("");
console.log("If we call L.marker([lat, lon]):");
console.log(" L.marker([" + lat + ", " + lon + "])");
console.log(" This should plot at: 18.0365°N, 68.625°W (Dominican Republic)");
console.log("");
console.log("If we call L.marker([lon, lat]):");
console.log(" L.marker([" + lon + ", " + lat + "])");
console.log(" This would plot at: -68.625°S, 18.0365°E (Indian Ocean!)");
Loading…
Cancel
Save

Powered by TurnKey Linux.