Skip to content

Latest commit

 

History

History
198 lines (150 loc) · 4.86 KB

File metadata and controls

198 lines (150 loc) · 4.86 KB

GNSS Satellite Tracker - Python Edition

A real-time GNSS satellite tracking application with Python backend and minimal JavaScript frontend.

🐍 Python-Focused Architecture

This application is built with Python doing the heavy lifting:

  • Backend: Flask REST API with Skyfield for orbital calculations
  • Frontend: Minimal JavaScript (only for 3D visualization)
  • All satellite calculations done in Python

🚀 Quick Start

1. Install Python Dependencies

pip install -r requirements.txt

2. Run the Application

python app.py

3. Open Browser

Navigate to http://localhost:5000

📁 Project Structure

satellite/
├── app.py                  # Python Flask backend (main application)
├── requirements.txt        # Python dependencies
├── templates/
│   └── index.html         # Flask template
├── static/
│   ├── js/
│   │   └── main.js        # Minimal JS (visualization only)
│   └── css/
│       └── style.css      # Styling

🔧 Python Backend Features

API Endpoints

GET /api/satellites

Get all GNSS satellites with current positions

  • Query param: time (ISO format, optional)
  • Returns: Array of satellites with positions, velocities, etc.

GET /api/satellite/<index>/info

Get detailed information for a specific satellite

  • Query param: time (ISO format, optional)
  • Returns: Full satellite data including orbital path

GET /api/satellite/<index>/orbit

Get orbital path for visualization

  • Query param: time (ISO format, optional)
  • Returns: Array of 3D coordinates

GET /api/constellations

Get list of available GNSS constellations

  • Returns: Array of constellation metadata

Python Libraries Used

  • Flask: Web framework and REST API
  • Skyfield: High-precision satellite position calculations
  • NumPy: Numerical computations
  • Requests: TLE data fetching from CelesTrak

🛰️ Supported GNSS Constellations

  • GPS (USA) - 31 satellites
  • GLONASS (Russia) - 24 satellites
  • Galileo (EU) - 30 satellites
  • BeiDou (China) - 35+ satellites

🎯 Key Features

Python Backend

✅ Real-time orbital calculations using Skyfield
✅ TLE data caching (5-minute cache)
✅ RESTful API design
✅ Accurate position/velocity calculations
✅ Orbital path generation
✅ Time travel support (any date/time)

JavaScript Frontend

✅ 3D Earth visualization (Three.js)
✅ Satellite point rendering
✅ Orbital path display
✅ Click to select satellites
✅ Real-time updates via API

📊 Python Code Breakdown

  • app.py: 300+ lines of Python
  • main.js: ~200 lines of JavaScript (minimal)

Python handles:

  • TLE data fetching and parsing
  • Satellite position calculations (lat/lon/alt)
  • Velocity calculations
  • Orbital period calculations
  • Orbital path generation
  • Time-based propagation

JavaScript handles:

  • 3D visualization only
  • User interface interactions
  • API calls to Python backend

🔬 Example Python Usage

from app import calculate_satellite_position, parse_tle
from datetime import datetime

# Load satellites
tle_data = fetch_tle_data('gps-ops')
satellites = parse_tle(tle_data, 'gps-ops')

# Calculate position
sat = satellites[0]['satellite']
time_obj = ts.utc(2025, 11, 29, 12, 0, 0)
position = calculate_satellite_position(sat, time_obj)

print(f"Latitude: {position['latitude']}°")
print(f"Longitude: {position['longitude']}°")
print(f"Altitude: {position['altitude']} km")

🌐 API Response Example

{
  "satellites": [
    {
      "name": "GPS BIIA-10 (PRN 32)",
      "group": "gps-ops",
      "groupName": "GPS (USA)",
      "color": "#00FF00",
      "position": {
        "x": 12345.67,
        "y": -8901.23,
        "z": 15678.90
      },
      "latitude": 45.1234,
      "longitude": -122.5678,
      "altitude": 20180.5,
      "speed": 3.87
    }
  ],
  "count": 120,
  "timestamp": "2025-11-29T21:00:00"
}

🔄 Data Flow

  1. User Action → JavaScript frontend
  2. API Request → Python Flask backend
  3. TLE Fetch → CelesTrak (cached)
  4. Skyfield Calculation → Satellite positions
  5. JSON Response → JavaScript frontend
  6. 3D Rendering → Three.js visualization

📦 Dependencies

Python

  • flask - Web framework
  • flask-cors - CORS support
  • skyfield - Satellite calculations
  • numpy - Numerical operations
  • requests - HTTP requests

JavaScript (CDN)

  • three.js - 3D rendering
  • satellite.js - TLE parsing (minimal use)

🎓 Learning Resources

📝 License

MIT License - Feel free to use for learning and projects!


Built with Python 🐍 | Powered by Skyfield & Flask