1
$\begingroup$
GeoDirection[{38,-76},{38,-75}]
(* 89.6922 Degrees *)

I am using version 12.0.0.

$\endgroup$
1
  • 1
    $\begingroup$ Try GeoDirection[{38, -76}, {38, -76 + 0.001}] and GeoDirection[{38, -76}, {38, -76 + 180}]. In the first case, the limit goes to 90 Degrees, and in the second case, it is 0 Degrees. Perhaps this sketch (!!) is of use. $\endgroup$
    – Domen
    Nov 22, 2021 at 22:11

1 Answer 1

8
$\begingroup$

The expected answer from GeoDirection will not be exactly 90 degrees for these inputs.

You are trying to find the direction between two points that lie on the same line of latitude. And the 38th line of latitude does run due east from 38°N 76°W and intersects 38°N 75°W.

But GeoDirection finds the heading of a geodesic ("great circle") route between the two given points, and lines of latitude are not great circles on Earth's surface. So there is a discrepancy between the line-of-latitude path and the great-circle path, explaining why the initial heading given by GeoDirection is a tiny bit north of east.

If I've done my spherical trigonometry correctly, then for two points at latitude $\lambda$ separated by a longitude $\Delta \phi$, the initial heading $\alpha$ between the two points will be given by $$ \cot \alpha = \sin \lambda \tan \frac{\Delta \phi}{2}. $$ Plugging in the numbers $\lambda = 38°$ and $\Delta \phi = 1°$ gives the same result as Mathematica. We also see that:

  • As $\Delta \phi \to 0$, the right-hand side goes to zero regardless of $\lambda$, and so $\alpha \to 90°$. Thus, for small changes in longitude, the heading approaches due east.
  • Similarly, for $\lambda = 0$, $\alpha = 90°$ regardless of $\Delta \phi$. This is because the line of 0° latitude is the Equator, which is a great circle on the Earth's surface.
$\endgroup$
2
  • 2
    $\begingroup$ The default datum assumes an ellipsoidal earth. But if you assume a spherical earth then you get exactly the same angle calculated here. In[24]:= 180/Pi*ArcCot[Sin[38 Degree] Tan[1 Degree/2]] - QuantityMagnitude[GeoDirection[GeoPosition[{38, -76}, "SphericalEarth"], GeoPosition[{38, -75}, "SphericalEarth"]]] Out[24]= 0. $\endgroup$
    – Greg Hurst
    Nov 23, 2021 at 0:00
  • $\begingroup$ @ChipHurst: Yes, fair enough; my calculation assumes a spherical Earth. $\endgroup$ Nov 23, 2021 at 2:10

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.