Upload
makgops432
View
9
Download
0
Embed Size (px)
DESCRIPTION
Calculate Distance & Bearing
Citation preview
Calculate distance, bearing and more between two latitude/longitude points
Top of FormDistanceThis page helps you to calculate great-circle distances betweentwo pointsusing the Haversine formula.The formula assumes that theearth is a sphere, (we know that it is "egg" shaped) but it is accurate enough*for our purposes.Enter the coordinates into the text boxes to try it out. It accepts a variety of formats: deg-min-sec suffixed with N/S/E/W (e.g. 404455N, 73 59 11W), or signed decimal degrees without compass direction, where negative indicates west/south (e.g. 40.7486, -73.9864):Lat 1:Long 1:Lat 2:Long 2:And you cansee it on a map(thanks to Google Maps)Haversine formula:R = earths radius (mean radius = 6,371km)lat = lat2 lat1long = long2 long1a = sin(lat/2) + cos(lat1).cos(lat2).sin(long/2)c = 2.atan2(a, (1a))d = R.c(Note that angles need to be in radians to pass to trig functions).
TheHaversineformula remains particularly well-conditioned for numerical computation even at small distances
Spherical lawof cosines:d = acos(sin(lat1).sin(lat2)+cos(lat1).cos(lat2).cos(long2long1)).R
Excel:=ACOS(SIN(Lat1)*SIN(Lat2)+COS(Lat1)*COS(Lat2)*COS(Lon2-Lon1))*6371
BearingFormula: =atan2(sin(long).cos(lat2),cos(lat1).sin(lat2) sin(lat1).cos(lat2).cos(long) )
Since atan2 returns values in the range - ... +, to normalise the result to a compass bearing, multiply by 180/ then use (+360) % 360, where % is modulo.This is the initial bearing which if followed in a straight line along a great-circle arcwill take you from the start point to the end point; in general, the bearing you are following will have varied by the time you get to the end pointFor final bearing, take the initial bearing from the end point to the start point and reverse it (using = (+180) % 360).
MidpointFormula:Bx = cos(lat2).cos(long)By = cos(lat2).sin(long)latm= atan2(sin(lat1) + sin(lat2), ((cos(lat1)+Bx) + By))lonm= lon1+ atan2(By, cos(lat1)+Bx)
Just as the initial bearing may vary from the final bearing, the midpoint may not be located half-way between latitudes/longitudes.Bottom of Form