A web app that visualizes global earthquake data on an interactive map using a static dataset. The visualization updates dynamically to simulate real-time data flow while remaining fully self-contained with no backend dependencies.
- Create an engaging, interactive map to display earthquake locations and magnitudes.
- Demonstrate proficiency in modern data visualization techniques and tools.
- Ensure the app is lightweight, responsive, and works on all modern browsers (including mobile).
- Use only publicly available static data to avoid external API dependencies.
- Frontend Framework: Next.js
- Data Visualization: D3.js (for map rendering) + React for UI
- Styling: Tailwind CSS
- Animation: GSAP (for smooth transitions)
- Hosting: Vercel
- Render a world map using D3.js's GeoJSON capabilities.
- Plot earthquake locations as:
- Circles scaled by magnitude (e.g., larger circles = higher magnitude).
- Color-coded markers based on depth (e.g., red = shallow, blue = deep).
- Use a static JSON dataset of historical earthquakes (embedded in the app).
- Simulate "real-time" updates by cycling through the dataset at intervals (e.g., new earthquakes appear every 5 seconds).
- Allow users to:
- Filter earthquakes by magnitude range (slider: 0–10 Richter scale).
- Toggle depth visualization (shallow vs. deep).
- Focus on specific regions using a dropdown (e.g., "Pacific Ring of Fire").
- Show details on hover/click:
- Magnitude
- Depth
- Location (nearest city/country)
- Timestamp
- Display a color-coded legend for depth and magnitude scales.
- Show real-time stats:
- Total earthquakes displayed
- Average magnitude
- Most active region
- Dataset: Use a static JSON file (e.g.,
earthquakes.json) containing:[ { "latitude": 34.0522, "longitude": -118.2437, "magnitude": 4.5, "depth": 10, "timestamp": "2023-01-01T12:00:00Z", "region": "California" }, // ...additional entries ] - Data Parsing: Convert timestamps to relative time (e.g., "2 hours ago") using
date-fns.
- Map Projection:
const projection = d3.geoMercator() .scale(150) .translate([width / 2, height / 2]);
- Earthquake Plotting:
const circles = svg.selectAll("circle") .data(earthquakes) .enter() .append("circle") .attr("r", d => d.magnitude * 2) .attr("fill", d => depthColorScale(d.depth));
- Use GSAP to animate the appearance/disappearance of earthquake markers.
- Implement a "ripple" effect on new earthquakes to simulate real-time updates.
- Implement data virtualization to handle large datasets efficiently.
- Use Web Workers (if needed) for heavy computations.
- Main View:
- 80% of screen: Interactive map.
- 20%: Control panel and stats.
- Mobile Optimization:
- Stack controls vertically below the map.
- Simplify tooltips for touch interactions.
- Magnitude Slider: Range input (0–10).
- Region Dropdown: Predefined tectonic regions.
- Depth Toggle: Switch between shallow (50km).
- Use Tailwind CSS for:
- Responsive grids
- Consistent spacing
- Themed colors (e.g., red for high magnitude)
- D3.js for map styling:
- Light gray for landmasses
- Blue gradients for ocean
- Initialize Next.js project with D3.js and Tailwind.
- Source and sanitize a static earthquake dataset (e.g., from USGS archives).
- Render world map using D3.js GeoJSON.
- Plot earthquake markers with basic scaling/coloring.
- Implement hover/click tooltips.
- Add filtering controls (slider, dropdown, toggle).
- Add GSAP animations for marker updates.
- Simulate real-time updates via
setInterval.
- Test with 10k+ data points (if possible).
- Implement data virtualization for performance.
- Deploy to Vercel.
- Ensure all data is self-contained (no external fetches).
- A public GitHub repo with:
- Complete source code
README.mdexplaining setup and data sources
- Hosted demo on Vercel.
- Performance metrics (e.g., <1s load time, 60 FPS animations).
- Add historical timelines (e.g., "earthquakes in the last 24 hours").
- Integrate WebGL for GPU-accelerated rendering.
- Allow users to upload custom datasets.