Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have a point $P$ on a unit sphere whose spherical coordinates are $(\theta, \varphi)$, and a great arc from point $Q$ to point $R$, also specified in spherical coordinates. I want to find the minimum distance (great arc distance, preferably) between the point and the arc. Can somebody help me on that?

My best guess would be to take the formula for the Great arc distance between two points on a unit sphere, plug in a point $S$ parameterized by $t$ on the arc between $Q$ and $R$, and find the minimum distance between $P$ and $S$. But I would definitely need help with that.

share|cite|improve this question

Consider the full great circle that your $Q$ to $R$ arc is part of. There are two points (poles) which are each 90 degrees of arc from every point on the great circle. (You can find these points by forming a 90-90-x triangle from your arc segment.) Choosing the point which is on the same hemisphere as your point $P$, there is an arc from this pole, through $P$, to the great circle. Since the length of this arc is 90 degrees, the distance from $P$ to the great circle is the complement of the distance from the pole to $P$.

Determining the distance from $P$ to the actual arc then is just a matter of determining if the intersection point is between $Q$ and $R$, and if not, determining the distances from $P$ to $Q$ and $R$ to get the minimum.

A note to anyone who objects to my use of degrees: sorry, but I use my spherical trig on the actual earth, where lat and long are still measured in degrees. And yes, I am aware it is not a true sphere, but that is a separate topic.

share|cite|improve this answer
Thanks, this makes a lot of sense. Let me see if I can work out all the details. – LarsH Mar 21 '13 at 23:56
P.S. funny that you're a geographer... I was debating whether I should ask this question on – LarsH Mar 22 '13 at 0:03
Actually, I've found that most GIS folks aren't aware of these complexities - they deal with too little of the earth at a time, or depend on the libraries to do it for them. I actually know it from real-world orbital trajectory calculations, so here or physics would be the right places. – half-integer fan Mar 22 '13 at 1:42
I didn't mention this because I don't know your level of familiarity with sperical trig, but one way to see if the tangent point is on the arc is to compare the bearings from the pole to each end point and the tangent point. Though you may need to be careful regarding which quadrant your results are coming back in; i.e., 0 is between 330 and 30. – half-integer fan Mar 22 '13 at 2:11
Regarding this last comment, which pole do you mean -- the point on the original y axis (90 degrees latitude), or the pole of the great circle through $Q$ and $R$? Regarding your initial answer, can you point me to how to form a 90-90-x triangle from the arc segment so as to find the poles? – LarsH Mar 22 '13 at 3:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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