Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
opensky
A Rust client for the OpenSky Network Trino database, providing access to historical ADS-B flight trajectory data.
Features
- Query historical flight state vectors from the OpenSky Trino database
- Filter by ICAO24 transponder code, callsign, time range, and geographic bounds
- Filter by departure/arrival airports
- Automatic OAuth2 authentication with token refresh
- Query result caching (Parquet format) for faster repeated queries
- Progress callbacks for long-running queries
- Export results to CSV or Parquet
- Built on Polars DataFrames for efficient data handling
- Command-line interface for quick queries without writing code
Installation
As a Library
Add this to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["full"] }
Command-Line Interface
Install the CLI tool with cargo:
Or build from source:
# Binary at target/release/opensky
Configuration
Before using the library, you need to configure your OpenSky Network credentials.
- Register for an account at opensky-network.org
- Create the configuration file:
| Platform | Config Path |
|---|---|
| Linux | ~/.config/opensky/settings.conf |
| macOS | ~/Library/Application Support/opensky/settings.conf |
| Windows | %LOCALAPPDATA%\opensky\settings.conf |
[default]
username = your_username
password = your_password
[cache]
purge = 90 days
You can also configure credentials using the CLI:
CLI Usage
The opensky CLI provides quick access to flight data from the command line.
Query Historical Data
# Query by ICAO24 address
# Query a specific time range
# Query with duration (30m, 2h, 1d, 1w max)
# Query by callsign
# Query by airport
# Limit results
Export Results
# Export to CSV
# Export to Parquet
Show Generated Query
Manage Configuration
# Set credentials
# View current configuration
Library Quick Start
use ;
async
Library Usage Examples
Query by Aircraft
let params = new
.icao24 // ICAO24 transponder code
.time_range;
let data = trino.history.await?;
Query by Callsign
let params = new
.callsign
.time_range;
Query by Airport
// Flights departing from Amsterdam Schiphol
let params = new
.departure
.time_range;
// Flights arriving at London Heathrow
let params = new
.arrival
.time_range;
// Flights departing from EHAM and arriving at EGLL
let params = new
.departure
.arrival
.time_range;
Flight List (flights_data4)
Query the flight list table for departure/arrival information:
// Get all flights from EHAM to EGLL on a given day
let params = new
.departure
.arrival
.time_range;
let flights = trino.flightlist.await?;
// Returns: icao24, callsign, firstseen, lastseen,
// estdepartureairport, estarrivalairport, day
Query by Geographic Bounds
let params = new
.bounds // west, south, east, north
.time_range
.limit;
Wildcard Queries
// All aircraft with ICAO24 starting with "485"
let params = new
.icao24
.time_range;
Progress Tracking
let data = trino
.history_with_progress
.await?;
Cache Control
// Use cache (default behavior)
let data = trino.history.await?;
// Force fresh query, bypass cache
let data = trino.history_cached.await?;
// Get cache statistics
let stats = cache_stats?;
println!;
// Clear all cached data
clear_cache?;
Working with Results
let data = trino.history.await?;
// Access the underlying Polars DataFrame
let df = data.dataframe;
println!;
// Export to different formats
data.to_csv?;
data.to_parquet?;
// Load from Parquet
let data = from_parquet?;
Data Columns
Queries return the following columns:
| Column | Type | Description |
|---|---|---|
time |
i64 | Unix timestamp (seconds) |
icao24 |
String | ICAO24 transponder address |
lat |
f64 | Latitude (degrees) |
lon |
f64 | Longitude (degrees) |
velocity |
f64 | Ground speed (m/s) |
heading |
f64 | Track angle (degrees, clockwise from north) |
vertrate |
f64 | Vertical rate (m/s) |
callsign |
String | Aircraft callsign |
onground |
bool | Whether aircraft is on ground |
squawk |
String | Transponder squawk code |
baroaltitude |
f64 | Barometric altitude (meters) |
geoaltitude |
f64 | Geometric altitude (meters) |
hour |
i64 | Hour partition (Unix timestamp) |
Running the Example
# With custom parameters
Related Projects
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
This library provides access to data from the OpenSky Network, a non-profit association based in Switzerland that provides open air traffic data for research and non-commercial purposes.