Skip to content

Latest commit

Β 

History

499 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 Earthquake Globe β€” API & Data Processing Module

πŸ‘¨β€πŸ’» Developer 2 β€” Backend/API System

This module handles the complete backend data flow for the Earthquake Globe project. It connects to the live USGS Earthquake API, fetches real-time earthquake data, processes the GeoJSON response, and provides clean formatted data for the 3D Globe and Dashboard modules.


πŸ“Œ Responsibilities

  • Fetch live earthquake data from USGS API
  • Process and clean raw GeoJSON data
  • Create reusable API utility functions
  • Handle API errors and loading states
  • Implement live auto-refresh system
  • Provide structured data for visualization

🌐 API Used

USGS Earthquake GeoJSON Feed

https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php

Current Endpoint

https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson

βš™οΈ Features

βœ… Real-time earthquake data fetching
βœ… GeoJSON data processing
βœ… Auto-refresh every 60 seconds
βœ… Error handling system
βœ… Reusable React hooks
βœ… Clean formatted earthquake objects


πŸ“ Folder Structure

src/
β”‚
β”œβ”€β”€ services/
β”‚   └── usgsApi.js
β”‚
β”œβ”€β”€ hooks/
β”‚   └── useEarthquakeData.js
β”‚
β”œβ”€β”€ utils/
β”‚   └── filterData.js
β”‚
└── mock/
    └── mockEarthquakeData.json

πŸ“¦ Technologies Used

  • JavaScript (ES6+)
  • React
  • Vite
  • Fetch API
  • USGS GeoJSON API

πŸš€ Installation

Clone repository:

git clone <repository-url>

Install dependencies:

npm install

Run development server:

npm run dev

πŸ“‘ Example API Fetch

const API_URL =
  "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson";

export async function fetchEarthquakeData() {
  try {
    const response = await fetch(API_URL);
    const data = await response.json();

οΏ½OB    return data.features.map((quake) => ({
      magnitude: quake.properties.mag,
      place: quake.properties.place,
      time: quake.properties.time,
      lat: quake.geometry.coordinates[1],
      lng: quake.geometry.coordinates[0],
      depth: quake.geometry.coordinates[2],
    }));
  } catch (error) {
οΏ½OB    console.error("Error fetching earthquake data:", error);
  }
}

οΏ½OB---

πŸ”„ Live Update System

setInterval(fetchEarthquakeData, 60000);

Updates earthquake data every 60 seconds. οΏ½OB

πŸ“Š Sample Data Structure

{
  "magnitude": 5.4,
οΏ½OB  "place": "Indonesia",
  "time": 1715660000000,
  "lat": -2.45,
  "lng": 118.22,
οΏ½OB  "depth": 35
}

οΏ½OB

🧠 Data Fields

οΏ½OB | Field | Description | οΏ½OB|------|-------------| | magnitude | Earthquake magnitude | οΏ½OB| place | Earthquake location | οΏ½OB| time | Timestamp | | lat | Latitude | οΏ½OB| lng | Longitude | | depth | Depth in KM |


οΏ½OB

πŸ”€ Git Branches

Main Branch

feature/api-system

Sub Branches

feature/usgs-fetch
feature/data-processing
feature/live-sync

🀝 Integration

This module supplies processed earthquake data to:

  • 🌍 Globe Visualization Module
  • πŸ“ˆ Dashboard & Analytics Module

πŸ‘¨β€πŸ’» Developer Info

Role: Backend/API & Data Processing
Project: Live Earthquake Globe
Technology: React + USGS API + JavaScript

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages