Given three points on a line in a geographic coordinate system, how does one calculate the angle formed by these three points?

Please, give a general solution but also include system specific examples if you like.

  • You mean the azimuth? – Kirk Kuykendall May 26 '11 at 14:30
  • Pythagorean theorem? – Andy W May 26 '11 at 14:30
  • 1
    Esri's projection engine, bundled with freely downloadable ArcGIS Explorer, can be used to get Azimuths. See example here – Kirk Kuykendall May 26 '11 at 16:37
  • @Kirk Nice tip. By using a single conformal projection and computing two azimuths (for the two legs of the triangle away from the angle) you can obtain the included angle by subtraction. – whuber May 26 '11 at 17:58

On a sphere you can use trigonometric identities. On an ellipsoid, to compute the angle B in triangle ABC, it is usually best to create points A' and C' at short distances from B along the edges BA and BC respectively, project A'BC' using a conformal projection (which by definition preserves angles), and compute the (Euclidean) angle at the projected point B. (You can use A' for A and C' for C when BA and BC are short distances.)

Of course, when three points are exactly "on a line," there is no need to compute: the angle is 180 degrees :-).

  • Thanks, I imagined a projection was needed at some point but wasn't sure if their was some voodoo to use when the coordinates were expressed as angles. Is their general rule for how close A and C should be to B? – Sean May 26 '11 at 17:52
  • @Sean I was afraid you would ask that :-). It depends on how accurate you need the angle. I wouldn't worry ordinarily about triangles even tens of kilometers on a side unless the calculation was being done for a surveyor or astronomer. In case the side lengths are measured in multiple degrees--hundreds of kilometers--it's probably worth finding closer points. – whuber May 26 '11 at 17:57
  • would it make a difference if the spheroid used in the projection was different from the original geographic one? My intuition tells me it would, but I'm not near a computer capable of finding out... – MerseyViking May 27 '11 at 7:41
  • @Mersey Yes, you are correct. It would make a difference unless the two spheroids were geometrically similar (same shape but different sizes). This is rare. However, in most cases the difference in angles will be so small as to be unimportant--different spheroids usually are, after all, each very good approximations to the earth's surface--but a change from a true sphere to one with a typical flattening (near 1/298) can be noticeable in some cases. – whuber May 27 '11 at 14:31
  • It may be worth mentioning that the projection needs to be conformal only at the vertex B where the angle is measured. For instance, any azimuthal projection based at B will work. The flexibility afforded by this wider range of choices may make it easier to find a suitable projection when A or C are far from B. – whuber Jul 31 '13 at 20:12

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.