I need to calculate how many longitude degrees a certain distance from a point are, with the latitude held constant. Here's an illustration:

enter image description here

Here x represents the longitude degrees, the new point can be on either side of the starting point. I'm using the haversine formula, which calculates the distance between two points on a sphere given a radius, $r$, and a pair of coordinates expressed in latiude, $\phi$, and longitude, $\lambda$, degrees:


Which can be reduced to, because of the latitude held constant:


I plugged it into WolframAlpha to isolate $\lambda_{2}$, and got these two solutions:



Here's an example of why I'm confused about this. The distance between two points, $40° lat, 10° lng$ and $40° lat, 11° lng$ is (we assume an earth radius of $6371km$):


Plugging those numbers into the 2nd of the two isolated formulas, we get:


Which is obviously quite far from our desired $11°$, what am I doing wrong here?

  • $\begingroup$ I don't like what happens in the step "I plugged it into WolframAlpha to isolate λ2, and got these two solutions:". If you take your final $\lambda_2$ expressions but without rooting the $\sin$, you get the correct answer. $\endgroup$ – AakashM Feb 25 '13 at 14:34

The problem is that you must have made a mistake while copying your formula in Mathematica. After extracting $\Delta\lambda$ from the formula of $d$, knowing $\phi$ constant, I obtain (when $\phi\neq\pi/2 + k\pi$): $$ \Delta\lambda = \pm 2 \arcsin\left\lvert \frac{\sin\frac{d}{2r}}{\cos\phi_1} \right\lvert $$

I must say I'm concerned that in this formula, the argument of arcsin might become greater than 1.. I did this rapidly but I might try to check how this works. Oh, and use radians with trig functions.

Edit: Here is your example with Matlab:

>> phi = 40 * pi/180; a = 10 * pi/180; b = 11*pi/180;
>> r = 6371;
>> d = 2*r*asin( sqrt( cos(phi)^2 * sin( (a-b)/2 )^2 ) )
d =  85.180
>> delta = 2*asin( abs( sin(d/(2*r))/cos(phi) ) )
delta =  0.017453
>> b-a
ans = 0.017453
  • $\begingroup$ Using this formula I get $\Delta\lambda=\pm=0.000304616$, converting that from radians to degrees gives me $\Delta\lambda=0.01745321°$ $\endgroup$ – soren.qvist Feb 25 '13 at 15:17
  • 1
    $\begingroup$ I didn't mean to offend you, it's just that I see no difficulty there and "my formula" does give the right result, judging from my edit. I don't know how you obtained |Δλ|=0.000304616. $\endgroup$ – Jonathan H Feb 26 '13 at 13:47
  • 1
    $\begingroup$ @Sh3ljohn: your formula is indeed correct. I derive it in my answer. (+1) $\endgroup$ – robjohn Feb 26 '13 at 15:35
  • 1
    $\begingroup$ @Sh3ljohn Don't worry about it, I used your formula wrong, thanks for the help! $\endgroup$ – soren.qvist Feb 26 '13 at 18:21

The Law of Cosines says $$ \begin{align} \cos\left(\frac dr\right)&=\sin^2(\phi)+\cos^2(\phi)\cos(\Delta\lambda)\\ 1-\cos\left(\frac dr\right)&=\cos^2(\phi)-\cos^2(\phi)\cos(\Delta\lambda)\\ &=\cos^2(\phi)(1-\cos(\Delta\lambda))\tag{1} \end{align} $$ Applying the identity $1-\cos(x)=2\sin^2(x/2)$ to $(1)$ yields $$ \begin{align} 2\sin^2\left(\frac{d}{2r}\right)&=\cos^2(\phi)\ 2\sin^2\left(\frac{\Delta\lambda}{2}\right)\\ \pm\sin\left(\frac{d}{2r}\right)&=\cos(\phi)\sin\left(\frac{\Delta\lambda}{2}\right)\tag{2} \end{align} $$ This yields the formula cited by Sh3ljohn: $$ \begin{align} \Delta\lambda &=\pm2\arcsin\left(\frac{\sin\left(\frac{d}{2r}\right)}{\cos(\phi)}\right)\\ &=\pm2\arcsin\left(\sec(\phi)\sin\left(\frac{d}{2r}\right)\right)\tag{3} \end{align} $$

It appears that you dropped a square in your equation $$ \lambda_2=\lambda_1\pm2\arcsin\left(\sec(\phi_1)\sqrt{\sin\left(\dfrac{d}{2r}\right)}\right) $$ which should actually be $$ \lambda_2=\lambda_1\pm2\arcsin\left(\sec(\phi_1)\sqrt{\sin^2\left(\dfrac{d}{2r}\right)}\right) $$ which is $(3)$ above.

  • $\begingroup$ Wow thanks! Quite the detailed answer here :) $\endgroup$ – soren.qvist Feb 26 '13 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.