← Back to API Ninjas
Find the airports nearest to a given latitude/longitude. Results are sorted by airport size (largest first), then by dis
Returns the airports nearest a coordinate, sorted by airport size then by distance. Requires `lat` and `lon`.
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/closestairport",
query: {
"lat": 123,
"lon": 123
}
});
console.log(output);Query parameters
latrequired
number
Latitude of the search center, in decimal degrees.
lonrequired
number
Longitude of the search center, in decimal degrees.
radius
number
Search radius in kilometres. Default is 50, maximum is 500. (Default: 50)
size
string
Restrict to airport size. (Allowed: large, medium, small)
has_iata
string
Filter by whether the airport has an IATA code. (Allowed: true, false)
min_runway_length
number
Minimum runway length in feet.
limit
number
Maximum number of results to return. Must be between 1 and 50. Default is 10. (Default: 10)
units
string
Distance units. Default is km. (Allowed: km, mi) (Default: km)