I would like to get the formula on how to calculate the Euclidian distance between two geographical co-ordinates on earth and heading angle relative to True North. Say from New York to New Dehli , I draw a straight line THROUGH THE EARTH - as they were two points in space. How can I calculate that angle from say New York to New Dehli if I was to draw a straight line through the surface of the earth . What kind of mathematical calculation/formula would be involved in order to do that ?
-
Could you elaborate on what you mean by angle? You can compute the distance between any two points on a sphere if you know their latitude and longitude, it's unclear what you mean by angle (relative to what vector/axis?) Or do you mean how to compute the direction of the vector given the longitude and latitude? – nathan lachenmyer Mar 12 '13 at 15:45
-
I would like to know this direction: "Face the QIBLAH (the direction of Mecca): In the U.S. A. the correct direction is generally SOUTHEAST. DO NOT follow the "magnetic" direction suggested by magnetic compasses. They are wrong. Please call us for an explanation. Briefly, the soul cannot be stopped by walls or mountains. Thus, the shortest way to Mecca is right through the earth, and not around the North Pole. During our Salat we bow and prostrate and we face a semi-circle, a wide range of angles." – real 19 Mar 12 '13 at 19:29
-
currently I am using Rhumb line heading , but I am not sure if its giving me the correct result although it still gives me ESE. – real 19 Mar 12 '13 at 19:33
-
The angle should be relative to true north on a x,y plane through the Earth – real 19 Mar 12 '13 at 20:15
-
'Mecca' is a city in the Middle East. 'Salat' is a form of Contact Prayer with the Creator of the Universe made in that direction as a focal point from any place on Earth – real 19 Mar 12 '13 at 20:19
1 Answers
Rhumb Line Navigation
Rhumb lines or loxodromes are tracks of constant true course. With the exception of meridians and the equator, they are not the same as great circles. They are not very useful approaching either pole, where they become tightly wound spirals. The formulae below fail if any point actually is a pole.
East-West rhumb lines are special. They follow the latitude parallels and form a closed curve. Other rhumb lines extend from pole-to-pole, encircling each pole an infinite number of times. Despite this, they have a finite length given by pi/abs(cos(tc)) (in our angular units, multiply by the radius of the earth to get it in distance units).
When two points (lat1,lon1), (lat2,lon2) are connected by a rhumb line with true course tc :
lon2-lon1=-tan(tc)*(log((1+sin(lat2))/cos(lat2))-
log((1+sin(lat1))/cos(lat1)))
=-tan(tc)*(log((1+tan(lat2/2))/(1-tan(lat2/2)))-
log((1+tan(lat1/2))/(1-tan(lat1/2))))
=-tan(tc)*(log(tan(lat2/2+pi/4)/tan(lat1/2+pi/4)))
(logs are "natural" logarithms to the base e.)
The true course between the points is given by:
tc= mod(atan2(lon1-lon2,log(tan(lat2/2+pi/4)/tan(lat1/2+pi/4))),2*pi) The dist, d between the points is given by:
if (abs(lat2-lat1) < sqrt(TOL)){
q=cos(lat1)
} else {
q= (lat2-lat1)/log(tan(lat2/2+pi/4)/tan(lat1/2+pi/4))
}
d=sqrt((lat2-lat1)^2+ q^2*(lon2-lon1)^2)
This formula fails if the rhumb line in question crosses the 180 E/W meridian. Allowing this as a possibility, the true course tc, and distance d, for the shortest rhumb line connecting two points is given by:
dlon_W=mod(lon2-lon1,2*pi)
dlon_E=mod(lon1-lon2,2*pi)
dphi=log(tan(lat2/2+pi/4)/tan(lat1/2+pi/4))
if (abs(lat2-lat1) < sqrt(TOL)){
q=cos(lat1)
} else {
q= (lat2-lat1)/dphi
}
if (dlon_W < dlon_E){// Westerly rhumb line is the shortest
tc=mod(atan2(-dlon_W,dphi),2*pi)
d= sqrt(q^2*dlon_W^2 + (lat2-lat1)^2)
} else{
tc=mod(atan2(dlon_E,dphi),2*pi)
d= sqrt(q^2*dlon_E^2 + (lat2-lat1)^2)
}

- 748
- 8
- 32