Metadata-Version: 2.4
Name: aeronavx
Version: 2.0.2
Summary: Advanced Aviation Analytics: Network Intelligence, Synthetic Routes, Emissions v2, Geo-Spatial Analysis & Passenger Experience
Author-email: Teyfik OZ <teyfikoz@example.com>
License: MIT
Project-URL: Homepage, https://github.com/teyfikoz/AeroNavX
Project-URL: Repository, https://github.com/teyfikoz/AeroNavX
Project-URL: Documentation, https://github.com/teyfikoz/AeroNavX/docs
Project-URL: Issues, https://github.com/teyfikoz/AeroNavX/issues
Keywords: airport,aviation,geodesy,geography,distance,routing,network-analysis,emissions,jet-lag,flight-planning,aviation-analytics
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Provides-Extra: full
Requires-Dist: pandas>=2.0; extra == "full"
Requires-Dist: scipy>=1.10; extra == "full"
Requires-Dist: rapidfuzz>=3.0; extra == "full"
Requires-Dist: timezonefinder>=6.0; extra == "full"
Requires-Dist: requests>=2.31; extra == "full"
Provides-Extra: api
Requires-Dist: fastapi>=0.104; extra == "api"
Requires-Dist: uvicorn[standard]>=0.24; extra == "api"
Provides-Extra: all
Requires-Dist: pandas>=2.0; extra == "all"
Requires-Dist: scipy>=1.10; extra == "all"
Requires-Dist: rapidfuzz>=3.0; extra == "all"
Requires-Dist: timezonefinder>=6.0; extra == "all"
Requires-Dist: requests>=2.31; extra == "all"
Requires-Dist: fastapi>=0.104; extra == "all"
Requires-Dist: uvicorn[standard]>=0.24; extra == "all"
Dynamic: license-file

# AeroNavX

A production-grade Python library for airport data and flight geometry calculations.

**🆕 v0.2.0:** Now with **84,000+ airports** from [OurAirports](https://ourairports.com) (MIT License)

## Features

- 🛫 **Airport Database**: 84,000+ global airports with efficient IATA/ICAO indexing
- 📏 **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
- 📊 **Analytics**: Statistics by country, continent, type, and elevation
- ⏰ **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

```bash
pip install aeronavx
```

**Or from source:**
```bash
git clone https://github.com/teyfikoz/AeroNavX.git
cd AeroNavX
pip install -e .
```

## Quick Start

```python
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 (plural for multiple results)
nearest = aeronavx.nearest_airports(41.0, 29.0, n=5)
for airport in nearest:
    print(f"  {airport.iata_code}: {airport.name}")

# Or get single nearest airport
closest = aeronavx.nearest_airport(41.0, 29.0)
print(f"Closest: {closest.name}")

# Estimate emissions
co2 = aeronavx.estimate_co2_kg_for_segment("IST", "JFK")
print(f"CO2: {co2:.2f} kg per passenger")
```

### Advanced: Filtering Airports

```python
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
```

## CLI Usage

```bash
# 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

```bash
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** from [OurAirports](https://ourairports.com/data/), which provides:
- ✅ **Global Coverage**: Airports, heliports, seaplane bases, and more
- ✅ **MIT License**: Free to use commercially
- ✅ **Regular Updates**: Community-maintained and updated
- ✅ **Comprehensive Data**: IATA/ICAO codes, coordinates, types, and more

**Data Attribution:**
Airport data from [OurAirports](https://ourairports.com) (David Megginson et al.) - Licensed under [MIT License](https://github.com/davidmegginson/ourairports-data)

## Examples

See `examples/` directory for:
- `basic_distance.py`: Distance calculations
- `nearest_airports.py`: Finding nearby airports
- `routing_example.py`: Multi-segment routes
- `emissions_example.py`: CO2 estimation

## Testing

```bash
pytest
```

## Dependencies

**Required**: Python >= 3.10

**Optional**:
- `pandas`: DataFrame support
- `scipy`: Faster spatial indexing
- `rapidfuzz`: Better fuzzy search
- `timezonefinder`: Timezone support
- `fastapi`, `uvicorn`: API server
- `requests`: Weather data

## License

MIT License

## Contributing

Contributions welcome! Please open an issue or pull request.
