This project combines real-time data visualization and web mapping to explore global seismic activity using data provided by the USGS Earthquake Hazards Program API. The final product is a browser-based interactive dashboard that displays recent earthquakes alongside dynamic charts, allowing users to visualize magnitude, frequency, and depth trends based on a selected time frame.
Fetching Earthquake Data:
fetch('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson')
.then(response => response.json())
.then(data => {
// parse and visualize data
});
Adding a Leaflet Marker for Each Earthquake:
var marker = L.circleMarker([lat, lon], {
radius: magnitude * 3,
fillColor: "#ff7800",
color: "#000",
weight: 1,
fillOpacity: 0.8
}).bindPopup(`Magnitude: ${magnitude}<br>Location: ${place}`);
Creating a Chart.js Line Chart:
new Chart(ctx, {
type: 'line',
data: {
labels: times,
datasets: [{
label: 'Magnitude Over Time',
data: magnitudes,
borderColor: 'orange',
backgroundColor: 'grey',
fill: false
}]
}
});
The final product delivers a user-friendly interface for exploring earthquake activity across different time windows. It offers real-time insights, improves data accessibility, and visually communicates seismic trends with clarity. The combined use of web mapping and interactive charts makes this project both informative and engaging.