0
$\begingroup$

Suppose I am standing at latitude, longitude $(-33, 151)$ and I want to calculate the angle between two points $(-32, 150)$ and $(-34, 152)$ from my point of view. Can someone please tell me how can I do that ?

$\endgroup$
1
  • $\begingroup$ Are you standing in Tarnow? $\endgroup$
    – copper.hat
    Mar 15, 2013 at 3:17

1 Answer 1

1
$\begingroup$

If a spherical earth is good enough, you can convert the three points to Cartesian coordinates: $x=R \cos \phi \cos \lambda, y=R \cos \phi \sin \lambda, z=R \sin \phi$. Then subtract to get the two vectors from where you are to the other two points and use the dot product formula. This will give the angle in space between the vectors.

$\endgroup$
5
  • $\begingroup$ Thanks for the answer Ross. Does the ϕ and λ represents latitude, longitude respectively ? $\endgroup$
    – user975027
    Mar 15, 2013 at 2:19
  • $\begingroup$ The cross product might be better for small angles, $\arccos$ is insensitive for small angles. Also, increasing $\phi$ corresponds to north, increasing $\lambda$ corresponds to east. $\endgroup$
    – copper.hat
    Mar 15, 2013 at 2:27
  • $\begingroup$ @user975027: yes. These are standard. $\endgroup$ Mar 15, 2013 at 2:28
  • $\begingroup$ @RossMillikan -is there a way to get the angle without converting to Cartesian ? Will calculating the great circle bearing give the same answer in terms of the arctan2 function? $\endgroup$
    – user297514
    Jun 2, 2016 at 11:44
  • $\begingroup$ @gansub: It depends what you want. The Cartesian conversion will give you vectors that go through the earth to the other points. If you are standing at a point and the two destinations are almost opposite you on the earth, the bearings of the great circles can be quite different but the angles through the earth are almost the same. $\endgroup$ Jun 2, 2016 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .