Production-grade airport data and flight geometry library
Project description
AeroNavX
A production-grade Python library for airport data and flight geometry calculations.
🆕 v0.3.0: Now with 47,000+ runways and comprehensive aviation statistics!
Features
- 🛫 Airport Database: 84,000+ global airports with efficient IATA/ICAO indexing
- 🛬 Runway Information: 47,000+ runways with dimensions, surfaces, and lighting data
- 📊 Aviation Statistics: Country, continent, and global aviation analytics
- 📏 Distance Calculations: Haversine, Vincenty, and Spherical Law of Cosines
- 🌍 Geodesy: Bearings, midpoints, great circle paths
- 🔍 Search: Fuzzy name search, nearest neighbor queries, radius search
- 🛤️ Routing: Multi-segment routes, flight time estimation, shortest paths
- ⏰ Timezone Support: Automatic timezone detection and local time
- 🌱 Emissions: CO2 emissions estimation per passenger
- 🌤️ Weather: METAR and TAF data fetching
- 💻 CLI: Command-line interface for quick queries
- 🌐 REST API: FastAPI-based web service
Installation
pip install aeronavx
Or from source:
git clone https://github.com/teyfikoz/AeroNavX.git
cd AeroNavX
pip install -e .
Quick Start
import aeronavx
# Get airports
ist = aeronavx.get_airport("IST")
jfk = aeronavx.get_airport("JFK")
# Calculate distance
dist_km = ist.distance_to(jfk)
print(f"Distance: {dist_km:.2f} km")
# Find nearest airports
nearest = aeronavx.nearest_airport(41.0, 29.0, n=5)
# Estimate emissions
co2 = aeronavx.estimate_co2_kg_for_segment("IST", "JFK")
print(f"CO2: {co2:.2f} kg per passenger")
Advanced: Filtering Airports
from aeronavx.core import loader
# Load only major airports (large + medium with scheduled service)
major_airports = loader.load_airports(
include_types=['large_airport', 'medium_airport'],
scheduled_service_only=True
)
print(f"Major airports: {len(major_airports):,}") # ~3,200
# Load specific countries
us_airports = loader.load_airports(countries=['US'])
print(f"US airports: {len(us_airports):,}") # ~20,000
# Load airports with IATA codes only
iata_airports = loader.load_airports(has_iata_only=True)
print(f"IATA airports: {len(iata_airports):,}") # ~9,000
Runway Information
import aeronavx
# Get all runways for an airport
runways = aeronavx.get_runways_by_airport("KJFK")
for rwy in runways:
print(f"{rwy.designation}: {rwy.length_ft:.0f}ft, {rwy.surface}")
# Get the longest runway
longest = aeronavx.get_longest_runway("KJFK")
print(f"Longest: {longest.designation} - {longest.length_ft:.0f}ft")
# Get only paved runways
paved = aeronavx.get_paved_runways("KJFK")
print(f"Paved runways: {len(paved)}")
Aviation Statistics
import aeronavx
# Global statistics
stats = aeronavx.get_global_stats()
print(f"Total airports: {stats.total_airports:,}")
print(f"Total runways: {stats.total_runways:,}")
print(f"Countries: {stats.countries_count}")
print(f"Longest runway: {stats.longest_runway_ft:,.0f} ft")
# Country statistics
us_stats = aeronavx.get_country_stats("US")
print(f"US has {us_stats.total_airports:,} airports")
print(f"Large airports: {us_stats.large_airports}")
print(f"Total runways: {us_stats.total_runways:,}")
# Continent statistics
eu_stats = aeronavx.get_continent_stats("EU")
print(f"Europe: {eu_stats.total_airports:,} airports")
print(f"Countries: {eu_stats.countries_count}")
# Top countries
top = aeronavx.get_top_countries_by_airports(5)
for country, count in top:
print(f"{country}: {count:,} airports")
CLI Usage
# Calculate distance
aeronavx distance --from IST --to JFK --unit nmi
# Find nearest airports
aeronavx nearest --lat 41.0 --lon 29.0 --n 5
# Search by name
aeronavx search --name "Heathrow"
# Estimate emissions
aeronavx emissions --from IST --to LHR
# Flight time
aeronavx flight-time --from IST --to JFK
API Server
python -m aeronavx.api.server
Then access:
- http://localhost:8000/health
- http://localhost:8000/airport/IST
- http://localhost:8000/distance?from=IST&to=JFK
- http://localhost:8000/nearest?lat=41.0&lon=29.0&n=5
Data
AeroNavX includes 84,000+ airports and 47,000+ runways from OurAirports, which provides:
- ✅ Global Coverage: Airports, heliports, seaplane bases, and runways worldwide
- ✅ MIT License: Free to use commercially
- ✅ Regular Updates: Community-maintained and updated
- ✅ Comprehensive Data: IATA/ICAO codes, coordinates, types, runway dimensions, surfaces, and more
Data Attribution: Airport and runway data from OurAirports (David Megginson et al.) - Licensed under MIT License
Examples
See examples/ directory for:
basic_distance.py: Distance calculationsnearest_airports.py: Finding nearby airportsrouting_example.py: Multi-segment routesemissions_example.py: CO2 estimation
Testing
pytest
Dependencies
Required: Python >= 3.10
Optional:
pandas: DataFrame supportscipy: Faster spatial indexingrapidfuzz: Better fuzzy searchtimezonefinder: Timezone supportfastapi,uvicorn: API serverrequests: Weather data
License
MIT License
Contributing
Contributions welcome! Please open an issue or pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters