Distance between two sets of coordinates... update

M

Marcus Fox

Sorry for making a new post, but it seems that the original has moved down
the page due to the date and wouldn't be as visible to new contributors.
Much more new information here.

Was using the Haversine formula to find the distance between two sets of
coordinates, but it seemed to break down where we didn't use North or West
coordinates, as Excel didn't like negative dd:mm:ss, as I would have has to
use for east and south. So I converted them to decimal degrees multiplying
by 24/-24 depending on a condition of N/S or E/W. The coordinates are
originally entered as they are on maps in dd:mm:ss format.

Lat1 is in B2, long1 is in B3, lat2 is in B5 and long 2 is in B6. The
letters N/S for latitude are in C2 and C5 and E/W in C3 and C6.

The formula is -

=6371*ACOS(COS(RADIANS(90-(IF(C2="S",B2*(-24),B2*24))))*COS(RADIANS(90-(IF(C
5="S",B5*(-24),B5*24))))+SIN(RADIANS(90-(IF(C2="S",B2*(-24),B2*24))))*SIN(RA
DIANS(90-(IF(C5="S",B5*(-24),B5*24))))*COS(RADIANS((IF(C3="E",B3*(-24),B3*24
))-(IF(C6="E",B6*(-24),B6*24)))))

Seems to work ok, until I realised that the earth isn't actually
spherical, - we can assume it is for the purposes of calculation, to get a
reasonably accurate approximation, as the above formula gives the radius of
curvature, but since the radius of curvature varies with latitude, say we
used a formula for an elipsoid, as the polar radius of the earth is 6357 km
and the equatorial radius 6378, would

Radius =
6378*(1-(1-6357^2/6378^2)^(1/2)^2)/(1-(1-6357^2/6378^2)^(1/2)^2SIN^2(lat))^(
3/2)

do instead of the figure of 6371 for the radius at the start of the first
equation, but I do notice I need to use a figure for the latitude, and since
I have two different latitudes as two different points, how do I integrate
it into my equation?

Marcus
 
M

Marcus Fox

Marcus Fox said:
Sorry for making a new post, but it seems that the original has moved down
the page due to the date and wouldn't be as visible to new contributors.
Much more new information here.

OK, I knew that spherical trigonometry wouldn't be the easiest subject for
one to get their head around, but was hoping someone would have some ideas,
LOL.

Marcus
 
W

WhiteStarLine

Hi Marcus,

If you really, really need this precision, I wouldn't approach it this
way. I use Excel as a quick satellite viewing angle predictor and
factor in zonal harmonics as it makes quite a difference to the local
observer's altitude / azimuth.

But firstly, why not simply use standard spherical trigonometry, as
suggested when you posted this to a satellite newsgroup. Lets get the
distance from Canberra to London:

Canberra
Latitude 1 -35.45
Longitude 1 149.09
London
Latitude 2 51.50
Longitude 2 -0.17

Theta = Longitude 1 - Longitude 2
Theta 149.26

Dist = sin(deg2rad(Latitude1)) * sin(deg2rad(Latitude2)) +
cos(deg2rad(Latitude1)) * cos(deg2rad(Latitude2)) *
cos(deg2rad(Theta))
Dist -0.889746961

Distance

10559.81698 miles
16994.3781 kilometres
9170.145065 nautical miles

Now, if you still want to factor in a 3% oblated spheroid, then move to
ECI vectors. Get the instantaneous position of each lat / lon on an
earth centred inertial system using the vernal equinox as your
reference. Factor in the meridional radius of curvature at latitude
(lat) as N = a[cos^2(lat)+(1-e^2)sin^2(lat)]^(0.5).

Use transformational matrices to get the relative XYZ vector. I can
send you the Excel spreadsheet if you want.
 
D

Dana DeLouis

COS(RADIANS(90-...etc
SIN(RADIANS(90-...etc

Hi. Just a note on your equations. When studying Spherical Geometry, you
will often have equations like you did above as
Cos(90-x). Just note that these equations reduce to just Sin(x).
And Sin(90-x) reduces to just Cos(x).
I have seen some complicated equations when working with earth as a
spheroid.
For example, given WhiteStarline's data, with an SemimajorAxis of 6378.137
and Earth's eccentricity of 0.081819, a distance of 16,990.7867 km vs a
distance of 16994.3781 km with a fixed Radius. (This depends on Radius used
also).
Good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top