Skip to main content

Open Air Traffic map based on ADS-B Exchange and Open Sky Data.

Project description

release deploy GitHub Release Libraries.io dependency status for GitHub repo


Local Flight Map

A real-time air traffic visualization tool that combines data from ADS-B Exchange and OpenSky Network to provide a comprehensive view of aircraft movements in your local area.

This app is currently hosted at local-flight-map.sarumaj.com.

screenshot.png

Features

  • Real-time aircraft tracking and visualization
  • Interactive map interface using Folium
  • Data integration from multiple sources:
    • ADS-B Exchange API
    • OpenSky Network API
    • HexDB.io
  • Fast and responsive web interface built with FastAPI
  • Asynchronous data fetching for optimal performance

API Documentation

Data Sources

The application integrates data from multiple sources to provide comprehensive flight information:

OpenSky Network API

  • Authentication: Username and password required for some endpoints
  • Endpoints:
    • /api/states/all: Get all aircraft states
    • /api/states/own: Get aircraft states from own feeder
    • /api/tracks/all: Get all flight tracks

ADS-B Exchange API

  • Authentication: API key required
  • Endpoints:
    • /v2/registration/{registration}: Get aircraft by registration
    • /v2/icao/{icao24}: Get aircraft by ICAO24 address
    • /v2/callsign/{callsign}: Get aircraft by callsign
    • /v2/sqk/{squawk}: Get aircraft by squawk code
    • /v2/mil: Get military aircraft
    • /v2/lat/{lat}/lon/{lon}/dist/{radius}: Get aircraft in area

HexDB API

  • Base URL: https://hexdb.io/
  • Endpoints:
    • /api/v1/aircraft/icao/{icao24}: Get aircraft information
    • /api/v1/airport/icao/{icao24}: Get airport information
    • /api/v1/route/icao/{callsign}: Get route information

API Client Usage

from local_flight_map.api import (
    ApiConfig,
    AdsbExchangeClient, HexDbClient, OpenSkyClient,
    Location, BBox
)
from datetime import datetime

# Initialize the API configuration
config = ApiConfig(
    ads_b_exchange_api_key="your_api_key",
    opensky_client_id="your_client_id",
    opensky_client_secret="your_client_secret"
)

# OpenSky Network API Examples
async with OpenSkyClient(config) as opensky_client:
    # Get all aircraft states
    states = await opensky_client.get_states_from_opensky()
    
    # Get states for specific aircraft
    aircraft_states = await opensky_client.get_states_from_opensky(
        icao24="icao24_code"
    )
    
    # Get states in a specific area
    area_states = await opensky_client.get_states_from_opensky(
        bbox=BBox(min_lat=40.0, max_lat=41.0, min_lon=-74.0, max_lon=-73.0)
    )
    
    # Get states from own feeder
    own_states = await opensky_client.get_my_states_from_opensky(
        serials=[1, 2, 3]  # Optional: filter by sensor serial numbers
    )
    
    # Get flight track for specific aircraft
    track = await opensky_client.get_track_by_aircraft_from_opensky(
        icao24="icao24_code",
        time_secs=datetime.now()
    )

# ADS-B Exchange API Examples
async with AdsbExchangeClient(config) as adsbexchange_client:
    # Get aircraft by registration
    aircraft_by_reg = await adsbexchange_client.get_aircraft_from_adsbexchange_by_registration(
        registration="N12345"
    )
    
    # Get aircraft by ICAO24 address
    aircraft_by_icao = await adsbexchange_client.get_aircraft_from_adsbexchange_by_icao24(
        icao24="icao24_code"
    )
    
    # Get aircraft by callsign
    aircraft_by_callsign = await adsbexchange_client.get_aircraft_from_adsbexchange_by_callsign(
        callsign="ABC123"
    )
    
    # Get aircraft by squawk code
    aircraft_by_squawk = await adsbexchange_client.get_aircraft_from_adsbexchange_by_squawk(
        squawk="7500"
    )
    
    # Get military aircraft
    military_aircraft = await adsbexchange_client.get_military_aircrafts_from_adsbexchange()
    
    # Get aircraft within range
    aircraft_in_range = await adsbexchange_client.get_aircraft_from_adsbexchange_within_range(
        center=Location(latitude=40.7128, longitude=-74.0060),  # New York City
        radius=50  # radius in nautical miles (92.6 km)
    )

# HexDB API Examples
async with HexDbClient(config) as hexdb_client:
    # Get aircraft information
    aircraft_info = await hexdb_client.get_aircraft_information_from_hexdb(
        icao24="icao24_code"
    )
    
    # Get airport information
    airport_info = await hexdb_client.get_airport_information_from_hexdb(
        icao24="KJFK"  # ICAO airport code
    )
    
    # Get route information
    route_info = await hexdb_client.get_route_information_from_hexdb(
        callsign="ABC123"
    )

Response Objects

OpenSky Network API

  • StateVector: Contains aircraft position, speed, altitude, and other flight data
    • Basic info: ICAO24, callsign, origin country
    • Position: latitude, longitude, altitude (barometric and geometric)
    • Performance: velocity, true track, vertical rate
    • Status: on ground, squawk, special position indicator
    • Source: position source (ADS-B, ASTERIX, MLAT, FLARM)
    • Category: aircraft category (Light, Small, Large, Heavy, etc.)
  • States: Collection of StateVector objects with timestamp
  • FlightTrack: Contains flight path data with waypoints
    • Basic info: ICAO24, callsign, start/end time
    • Path: list of waypoints with position and altitude data
  • Waypoint: Individual position point in a flight track
    • Time: Unix timestamp
    • Position: latitude, longitude
    • Altitude: barometric altitude
    • Track: true track angle
    • Status: on ground flag

ADS-B Exchange API

  • AircraftProperties: Detailed aircraft information including:
    • Basic info: ICAO24, registration, type, callsign
    • Position: latitude, longitude, altitude (barometric and geometric)
    • Performance: ground speed, airspeed (indicated/true), Mach number
    • Weather: wind direction/speed, outside air temperature
    • Navigation: track angle, heading, rate of climb/descent
    • System status: squawk, emergency status, category
    • Technical: signal strength, GPS status, message count
    • Navigation modes: QNH, MCP/FMS altitude, heading
    • Integrity: navigation accuracy, surveillance level
  • AdsbExchangeResponse: Container for aircraft data with:
    • List of aircraft
    • API message
    • Timestamps
    • Processing information

HexDB API

  • AircraftInformation: Aircraft registration and type details
    • Basic info: ICAO type code, manufacturer, Mode S code
    • Registration: operator flag code, registered owners, registration number
    • Type: aircraft type description
  • AirportInformation: Airport location and identification
    • Codes: IATA, ICAO, country code
    • Location: latitude, longitude
    • Details: airport name, region name
  • RouteInformation: Flight route details
    • Flight: flight number
    • Route: route description
    • Update time: timestamp of last update

All response objects support conversion to GeoJSON format for easy integration with mapping libraries.

Requirements

  • Python 3.12 or higher
  • Internet connection for API access
  • Web browser for viewing the map interface

Installation

  1. Clone the repository:
git clone https://github.com/sarumaj/local-flight-map.git
cd local-flight-map
  1. Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install the package:
pip install -e .

Configuration

Create a .env file in the project root with your API credentials:

ADS_B_EXCHANGE_API_KEY=your_api_key_here
OPENSKY_USERNAME=your_username_here
OPENSKY_PASSWORD=your_password_here

Usage

  1. Start the application:
local-flight-map
  1. Open your web browser and navigate to http://localhost:5006

  2. The interactive map will display:

    • Current aircraft positions and path tracking
    • Aircraft information on hover
    • Real-time updates

Development

To run tests:

pip install -e ".[test]"
pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

local_flight_map-1.2.1.tar.gz (400.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

local_flight_map-1.2.1-py3-none-any.whl (409.0 kB view details)

Uploaded Python 3

File details

Details for the file local_flight_map-1.2.1.tar.gz.

File metadata

  • Download URL: local_flight_map-1.2.1.tar.gz
  • Upload date:
  • Size: 400.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for local_flight_map-1.2.1.tar.gz
Algorithm Hash digest
SHA256 fdd5533c548a94214c523d766dfe7a0baccfc4f85e7772252d63a5ca0ce2c020
MD5 8f09a819d86e7ac389e7df258ba94dbe
BLAKE2b-256 4834f90fc715420ebc4d5da32bef559f33b82ffb1fcd55b6e79beb1db2befa25

See more details on using hashes here.

File details

Details for the file local_flight_map-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for local_flight_map-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10b6b30dee324996353ca6632e2193f9542547420d19410ddecf6818c8ef5aa2
MD5 cbf9540ba4b5086544b747fce5a21900
BLAKE2b-256 cf859e45fb051613888be0eb9c953631fc4d8fff469830766097bb51dc340aae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page