← Back to API Ninjas
Calculate the great-circle distance, initial bearing, and estimated flight time between two airports. Premium only.
Calculates great-circle distance, initial bearing, and estimated flight time between two airports. Requires `from` and `to`.
API Ninjas·$0.001 per call
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "api-ninjas",
path: "/v1/airportdistance",
query: {
"from": "example",
"to": "example"
}
});
console.log(output);Query parameters
fromrequired
string
Origin airport - IATA (3 chars) or ICAO (4 chars) code.
torequired
string
Destination airport - IATA (3 chars) or ICAO (4 chars) code.
units
string
Distance units. Default is km. (Allowed: km, mi, nm) (Default: km)