How can I calculate the distance to a line across the US using a point of longitude and latitude?

44 Views Asked by At

I am working on a research project and was wondering if anyone can help me set up a formula. I am given a series of longitude and latitude points and am trying to calculate their respective distances from the line of totality during the US 2017 Solar Eclipse that occurred on Aug 21st. I know that the curvature of the earth may complicate this, but I would appreciate any help.

1

There are 1 best solutions below

2
On

What you're asking, roughly, is to find the distance from a point to a Great Circle on the Earth. This document is answering essentially the same question, although it doesn't give an explicit formula.

What you have to do, roughly, is the following:

  1. Convert all of your latitude and longitude pairs into vector (xyz) coordinates relative to the centre of the Earth.

  2. Take your vectors A and B pointing to two points on the line, and find their cross-product $A \times B$, and normalise that to get $N = \frac{A \times B}{|A \times B|}$.

  3. Take the dot-product $N \cdot C$ and find its arccosine, which is an angle value in radians.

  4. Take the difference between that angle and $\pi$, and multiply by the radius of the Earth to get the distance required.

There's a little inaccuracy in there, mostly from assuming that the Earth is perfectly spherical, but it should be good to within ~0.5% or so (given the known error in using the Haversine formula for finding differences between two points on Earth).