Wednesday, July 27, 2011

Do You Like Science? Great Circle Formula w/ Lat and Long Coordinates

I've constructed a database of nearly 200 locations using 'approximated' coordinates. The program is actually quite powerful and uses several Excel functions to convert the coordinates into an 'as the crow flies' distance by using the Great Circle formula.

So, it's been a painstaking process just to dig out the formula in order to show you 'how easy' it is to use.
    A                                    C                    D                       E                     F

 
1From:

Lat 1(deg)

Long 1(deg)

Lat 1(rad)

Long 1(rad)

2Ashland KY

38.475

-82.658

0.6715

-1.4427

4To:

Lat 2(deg)

Long 2(deg)

Lat 2(rad)

Long 2(rad)

5Louisville(SDF)

38.192

-85.731

0.6666

-1.4963

7Distanc(Miles)

167.62

This is just a generic presentation of the Great Circle formula using Excel. The coordinates above may not be 'official', but close enough.

Since the formula uses radians, we first have to convert the 'degrees' coordinates into radians. Quite easy to convert that. In cells E2, E5, F2, and F5, just multiply by Pi and divide by 180. Here's what that looks like...
From cell E2, the conversion formula says:
=C2*PI()/180

In cell A8, the Great Circle formula is as follows...
=6367*ACOS((SIN(E2)*SIN(E5))+(COS(E2)*COS(E5))*(COS(F2-F5)))/1.609

I've seen other versions of the Great Circle formula but prefer to use this one. I've noticed that this formula approximates the distance more accurately when compared to Atlas programs and the NWS coordinates for specified locations.

My program actually uses additional Excel functions that incorporate MATCH, INDEX, LOOKUP, and nested IF statements. Therefore, I have what I call a practical storm-intercept tool to help me track storms and, using roadway maps, attempt to intercept the storm.

Here is the one line from my program where the Great Circle formula was buried...man, that was tough to do.

=6367*ACOS((SIN(VLOOKUP($B$6,'LAT_LONG Table'!$A$2:$F$199,5,FALSE))*SIN(VLOOKUP($D$6,'LAT_LONG Table'!$A$2:$F$199,5,FALSE))+COS(VLOOKUP('DISTANCE Table'!$B$6,'LAT_LONG Table'!$A$2:$F$199,5,FALSE))*COS(VLOOKUP('DISTANCE Table'!$D$6,'LAT_LONG Table'!$A$2:$F$199,5,FALSE))*COS((VLOOKUP($B$6,'LAT_LONG Table'!$A$2:$F$199,6,FALSE))-VLOOKUP('DISTANCE Table'!$D$6,'LAT_LONG Table'!$A$2:$F$199,6,FALSE))))/1.609

MS

No comments:

Post a Comment

Tornadoes on Easter Sunday

This is a worse case scenario. Tornadoes and flooded, blocked roadways making for great difficulties reaching residences affecting hard hit ...