Calculating distance between two airports?
#1
Original Poster
Join Date: Sep 2004
Location: SFO
Programs: UA & SPG
Posts: 257
Calculating distance between two airports?
Given the latitude, longitude, and elevation of two airports, what is the formula for calculating the distance between the two? I tried searching the web but couldn't find anything.
#2
Moderator, Hilton Honors
Join Date: Nov 2003
Location: on a short leash
Programs: some
Posts: 71,422
check out Great Circle Mapper
#3
FlyerTalk Evangelist
Join Date: Jan 2004
Location: Worldwide
Posts: 12,949
Originally Posted by mshafrir
Given the latitude, longitude, and elevation of two airports, what is the formula for calculating the distance between the two? I tried searching the web but couldn't find anything.
Is there a simple way to compute great circle distances?
Assuming Earth is a perfect sphere of radius 6371.2 km, convert longitude and latitude to radians (multiply by pi/180), then compute as follows:
theta = lon2 - lon1
dist = acos(sin(lat1) × sin(lat2) + cos(lat1) × cos(lat2) × cos(theta))
if (dist < 0) dist = dist + pi
dist = dist × 6371.2
The resulting distance is in kilometers.
Assuming Earth is a perfect sphere of radius 6371.2 km, convert longitude and latitude to radians (multiply by pi/180), then compute as follows:
theta = lon2 - lon1
dist = acos(sin(lat1) × sin(lat2) + cos(lat1) × cos(lat2) × cos(theta))
if (dist < 0) dist = dist + pi
dist = dist × 6371.2
The resulting distance is in kilometers.