开发者

Calculate Distance Between Airports Using IATA Codes

开发者 https://www.devze.com 2023-03-26 16:08 出处:网络
I need to find the distance (as the Airbus A320 flies, not super accurate) between two airports, preferably using IATA codes (PHX, LAX, CLT for example).

I need to find the distance (as the Airbus A320 flies, not super accurate) between two airports, preferably using IATA codes (PHX, LAX, CLT for example).

I see 开发者_StackOverflow社区many websites that do this but I need to find an API (Google Maps, Bing Maps?) that I could use to calculate the distances with. I'm aware that I might have to geo code the IATA codes, but I'd like to avoid that (I know that using Google maps you can specify the IATA code+Airport and it will get the location)

Any suggestions?


You can simply store a database of airport codes and their latitude and longitude (Wikipedia probably has those coordinates). Then you can calculate the geographic distance (e.g., the geodetic distance) between those airports on your own server and/or with JavaScript code, rather than rely on Google Maps or the like, unless the desired airport isn't on the database. See also the geographiclib library or http://www.movable-type.co.uk/scripts/latlong.html.


There is a free API from SITA*. Details can be found here. https://www.developer.aero/Airport-API/

Usage:

curl -v  -X GET "https://airport.api.aero/airport/distance/ORK/LHR?user_key=[Your_User_Key]&units=km"

*Note - I work for SITA.


There are tens of thousands of airports in the world, if you would find a database of all airports with latitudes and longitudes, you could set up a formula to calculate the distance between each and every one of them.

If you know how to work with REST API, you could use Aviation Edge which has a feature that allows you to find airports and cities nearby a certain coordinate. This should fit your requirements. Have a look at their developers page

0

精彩评论

暂无评论...
验证码 换一张
取 消