airport-dist
v1.2.3
Published
CLI tool to calculate geographical and aviation route distances between airports, with flight time estimates
Maintainers
Readme
airport-dist
A CLI tool to calculate geographical and aviation route distances between airports using IATA codes, with flight time estimates.
Installation
npm install -g airport-distUsage
# Using long flags
airport-dist --from JFK --to LAX
# Using short flags
airport-dist -f LHR -t DXBOutput
The tool provides two distance measurements plus flight time:
- Geographical Distance - Great circle (Haversine) distance, the shortest path between two points on Earth
- Aviation Route Distance - Actual airline route distance from bundled route database (55,000+ routes)
- Flight Time - Estimated flight duration from airline data
Calculating distances from JFK to LAX...
Airports Found:
From: John F. Kennedy International Airport (New York, United States)
To: Los Angeles International Airport (Los Angeles, United States)
============================================================
DISTANCE RESULTS
============================================================
1. GEOGRAPHICAL DISTANCE (Great Circle / Haversine):
3974.34 km
2469.54 miles
2145.97 nautical miles
2. AVIATION ROUTE DISTANCE:
3982.00 km
2474.30 miles
2150.11 nautical miles
Flight time: 6h 19m
Source: Airline route data (bundled)
============================================================
Note: Aviation routes may differ from great circle distance due to
airways, restricted airspace, weather patterns, and traffic flow.Options
| Option | Alias | Description |
|--------|-------|-------------|
| --from | -f | Origin airport IATA code (e.g., JFK) |
| --to | -t | Destination airport IATA code (e.g., LAX) |
| --version | -V | Show version number |
| --help | -h | Show help |
Data Sources
- Airport Database: 150+ major international airports with coordinates
- Route Database: 55,000+ airline routes with distances and flight times from Jonty/airline-route-data
- Fallback: Estimation using industry-standard routing factors when route not in database
How It Works
Geographical Distance: Calculated using the Haversine formula, which determines the great-circle distance between two points on a sphere given their latitudes and longitudes.
Aviation Route Distance: Sourced from bundled airline route data containing actual flight distances. Falls back to estimation for routes not in the database.
Flight Time: Sourced from bundled airline route data. Only available for routes in the database.
License
MIT
