Sunteți pe pagina 1din 6

Latitude, Longitude, And Great Circles This page describes how to work with Latitude and Longitude in Excel

and how to compute Great Circle Distances.

Introduction ou can use Excel!s trigonometric and time "unctions to work with Latitude and Longitude #alues. There are two di""erent wa$s express geographical coordinates. The "irst is to use a time "ormat o" degrees%minutes%seconds. This is the same "ormat as an Excel time #alue. The other method is to use decimal degrees, representing #alues as the number o" degrees as a real number. &or example, the location '( degrees, )( minutes, *( seconds can be represented as the time '(%)(%*( or in decimal degrees as '(.+,,,,.

ou can download the "ile with all the example "ormulas and code on this page.

-emispheres And .ositi#e And /egati#e Coordinates I" $ou are restricting $oursel" to one hemisphere "or latitude and one hemisphere "or longitude, $ou can use either time "ormat or decimal degrees "ormat and use posti#e #alues "or both. I" $ou are working with two hemispheres, $ou must choose one hemisphere to be positi#e and then use negati#e #alues "or locations in the other hemisphere. This is "ine "or decimal degree #alues, but Excel can!t displa$ negati#e time #alues. There"ore, i" $ou are working in two hemispheres, $ou need to use the decimal degrees "ormat or set the date s$stem to the ,0(* base. To change the date "ormat, go to the Tools menu, choose Options and then the Calculation tab. There, check the 1904 date system setting. 1hen using positi#e and negati#e #alues to speci"$ the hemisphere, it doesn!t matter which hemisphere is assigned to positi#e numbers and which is assigned to negati#e numbers. -owe#er, $ou must be consistent in all $our calculations. I" /orth is positi#e in one set o" coordinates, it must be positi#e in all coordinates.

/umber &ormatting &or Latitude And Longitude I" $ou are using the time "ormat "or latitude and longitude #alues, $ou will need to change the number "ormat "or those cells. 2$ de"ault, when $ou enter a time in a cell, Excel will use the Short Time "ormat as speci"ied in the 1indows 3egional 4ettings. Excel will 5roll6o#er5 times at '* hours 7although the underl$ing #alue remains correct8. &or example, the time #alue )(%*(%+(

is displa$ed as (9%*(%+(. To correct this, $ou can use a number "ormat o" :hh;%mm%ss. The s<uare brackets : ; instruct Excel not to roll o#er the displa$ed #alue as a 5time o" da$5 #alue. Also, $ou can instead use a custom number "ormat to displa$ time6"ormat latitude and longitude #alues with a cartographic "ormat. 4elect the cells that $ou want to "ormat, go to the Format menu, choose Cells and then the Number tab. There, choose Custom in the Category list and enter :hh;= mm! ss>5 in the Type text box. To enter the degree s$mbox 7=8, hold down the ALT ke$ and press (,?9 on the numeric ke$pad on the right side o" the ke$board 7do not use the numbers abo#e the letters8. This number "ormat will displa$ the time "ormatted coordinate #alue '(%)(%*(, "or example, as '(@ )(! *(5. /ote, though, that e#en though the cell is "ormated to displa$ degrees, minutes, and seconds, $ou must enter the number as a time using the 5%5 character 66 e.g., '(%)(%*(.

Con#erting 2etween Time &ormat Coordinates And Decimal Degrees 4ince time "ormatted coordinates are Aust numbers representing the "raction o" a '*6hour da$ 7(9%((%(( B (.'+, ,'%((%(( B (.+, ,C%((%(( B (.?+, etc.8, $ou can multipl$ a time "ormat coordinate b$ '* to get the decimal degrees #alue. &or example, i" cell A, has the #alue '(%)(%*(, $ou can use BA,D'* to get the decimal degrees result, in this case '(.+,,,,,. 4imilarl$, $ou can con#ert a decimal degree #alue to time "ormat b$ di#iding b$ '*. &or example, B2,E'*. 2e sure to "ormat the cells with a number "ormat o" :hh;%mm%ss or :hh;= mm! ss>5.

Determining Degrees, Finutes, And 4econds I" $ou ha#e coordinate #alues in time "ormat, $ou can use the "ollowing "ormulas to extract the degree, minute, and second #alues. In all these examples, the time "ormat #alue is assumed to be in cell A,. BI/T7A,8 returns degrees BFI/GTE7A,8 returns minutes B4ECH/D7A,8 returns seconds. &or decimal degrees #alues, use the "ormulas% BI/T7A,8 returns degrees BFI/GTE77A,6I/T7A,88E'*8 returns minutes B4ECH/D77A,6I/T7A,88E'* returns seconds.

In addition to the "ormulas abo#e, $ou can use an arra$ "ormula to split out the degree, minute, and second #alues "rom either a time6"ormat #alue or a decimal degree #alue. To split out the component "rom a time6"ormat #alue, select the three cells that will get the component #alues and enter the "ollowing arra$ "ormula% BI,,(,(JDI/T7A,D'*8KI(,,,(JDFI/GTE7A,8KI(,(,,JD4ECH/D7A,8 and press CT3L 4-I&T E/TE3. &or more in"ormation about arra$ "ormulas, see the arra$ "ormulas page on this web site. In the "ormula abo#e, note the di""erences between the parentheses and the curl$ braces I J. To break out the degrees, minutes, and seconds #alues "rom a decimal degrees #alue, use the "ollowing arra$ "ormula. 4elect the cells that will get the component #alues, t$pe the "ormula, and press CT3L 4-I&T E/TE3. BI,,(,(JDI/T7A,8KI(,,,(JDFI/GTE7A,E'*8KI(,(,,JD4ECH/D7A,E'*8 As be"ore, note the di""erence between the parentheses and the curl$ braces.

Great Circle Distances In Fathematics and Cartograph$, a Great Circle Distance is the shortest path between two points on the sur"ace o" a sphere 7and we will assume that the Earth is a per"ect sphere, e#en though it reall$ isn!t8. This is the 5as the crow "iles5 distance between the two points. All lines o" Longitude are Great Circles, while the E<uator is the onl$ Latitudinal Great Circle. To calculate the Great Circle Distance between points, we "irst calculate the spherical central angle between the two points and then multipl$ that angle 7in 3adians8 b$ the radius o" the Earth. Don!t worr$ i" $ou don!t know what spherical central angle means 66 the "ormulas will calculate it "or $ou. The e<uation used in the "ormulas is

/ote that Excel!s trigonometric "unctions work onl$ with 3adians, not Degrees, so the coordinate #alues must be con#erted "rom Degrees to 3adians. The 3ADIA/4 "unction is used to con#ert Degrees to 3adians. Great Circle Distances 1ith Time &ormat Coordinates

To calculate the Great Circle Distance between Location, and Location', use the "ormula% B3adiusEarthD77'DA4I/74L3T774I/773ADIA/47D*0D'*863ADIA/47D+(D'*88E'8M'8 KCH473ADIA/47D*0D'*88DCH473ADIA/47D+(D'*88D 74I/773ADIA/47E*0D'*863ADIA/47E+(D'*88E'8M'88888 In this example, the 3adiusEarth is a named cell with the #alue 9)?(.0?)'?C9''?) "or nautical kilometers or )0+C.?)0'9,C+ "or nautical miles. Fultipl$ either #alue b$ ,.,+(??0**C( to get the length in statute kilometers or statute miles. Cells D*0 and E*0 are the latitude and longitude o" Location , and cells D+( and E+( are the latitude and longitude o" Location '. These coordinates are in Time "ormat. The result is the distance in either miles or kilometers, depending on the #alue in the cell named 3adiusEarth. &or readabilit$, the "ormula is broken into se#eral lines. In Excel, o" course, the "ormula is in a single line in a single cell. The same "ormula, using de"ined names "or coordinates is shown below. Lat,N and Long,N are the coordinates o" the "irst location. Lat'N and Long'N are the coordinates o" the second location. B3adiusEarthD77'DA4I/74L3T774I/773ADIA/47Lat,ND'*86 3ADIA/47Lat'ND'*88E'8M'8KCH473ADIA/47Lat,ND'*88DCH473ADIA/47Lat'ND'*88D 74I/773ADIA/47Long,ND'*863ADIA/47Long'ND'*88E'8M'88888 Great Circle Distances 1ith Decimal Degrees Coordinates To calculate the Great Circle Distance between Location , and Location ', where the coordinates are in decimal degree "ormat, use the "ollowing "ormula% B3adiusEarthD77'DA4I/74L3T774I/773ADIA/47D?,863ADIA/47D?'88E'8M'8K CH473ADIA/47D?,88DCH473ADIA/47D?'88D 74I/773ADIA/47E?,863ADIA/47E?'88E'8M'88888 -ere, cells D?, and E?, contain the latitude and longitude o" Location , and cells D?' and E?' contain the latitude and longitude o" Location '. &or readabilit$, the "ormula is split o#er se#eral lines. In Excel, o" course, the "ormula is in a single line in a single cell. The same "ormula, using de"ined names "or the coordinates is shown below. Lat,NN and Long,NN are the coordinates o" the start location and Lat'NN and Long'NN are the coordinates o" the end location. B3adiusEarthD77'DA4I/74L3T774I/773ADIA/47Lat,NN863ADIA/47Lat'NN88E'8M'8K CH473ADIA/47Lat,NN88DCH473ADIA/47Lat'NN88D 74I/773ADIA/47Long,NN86 3ADIA/47Long'NN88E'8M'88888 Great Circle Distances In O2A The "ollowing O2A code will calculate a Great Circle Distance in either Pilometers or Files 7as speci"ied in the 3esultAsFiles parameter 66 True indicates Files, &alse indicates Pilometers8.

The inputs ma$ be either decimal degrees or time6"ormat #alues. 74et the OaluesAsDecimalDegrees parameter to True "or decimal degrees, &alse "or Time degrees.8
Private Const C_RADIUS_EARTH_KM As Double = 637 !"73#7$6# Private Const C_RADIUS_EARTH_MI As Double = 3"%$!73"#6&$% Private Const C_PI As Double = 3!&'&%"#6%3%$"7" (un)tion *reatCir)leDistan)e+,atitu-e& As Double. ,on/itu-e& As Double. _ ,atitu-e# As Double. ,on/itu-e# As Double. _ 0aluesAsDe)i1alDe/rees As 2oolean. _ ResultAsMiles As 2oolean3 As Double Di1 Di1 Di1 Di1 Di1 Di1 ,at& As Double ,at# As Double ,on/& As Double ,on/# As Double 4 As ,on/ Delta As Double

I5 0aluesAsDe)i1alDe/rees = True T6en 4 = & Else 4 = #' En- I5 7 )onvert to -e)i1al -e/rees ,at& = ,atitu-e& 8 4 ,on/& = ,on/itu-e& 8 4 ,at# = ,atitu-e# 8 4 ,on/# = ,on/itu-e# 8 4 7 )onvert to ra-ians9 ,at& = +,at& : &$ 3 8 ,at# = +,at# : &$ 3 8 ,on/& = +,on/& : &$ 3 ,on/# = +,on/# : &$ 3 ra-ians = +-e/rees:&$ 3 8 PI C_PI C_PI 8 C_PI 8 C_PI

7 /et t6e )entral s;6eri)al an/le Delta = ++# 8 Ar)Sin+S<r++Sin++,at& = ,at#3 : #3 > #3 ? _ Cos+,at&3 8 Cos+,at#3 8 +Sin++,on/& = ,on/#3 : #3 > #33333 I5 ResultAsMiles = True T6en *reatCir)leDistan)e = Delta 8 C_RADIUS_EARTH_MI Else *reatCir)leDistan)e = Delta 8 C_RADIUS_EARTH_KM En- I5 En- (un)tion (un)tion Ar)Sin+4 As Double3 As Double 7 02A -oesn7t 6ave an Ar)Sin 5un)tion! I1;rovise! Ar)Sin = Atn+4 : S<r+=4 8 4 ? &33 En- (un)tion

Great Circle 2earings

ou can calculate the initial and terminal bearing o" a great circle with "ormulas. The initial bearing is the bearing at which one would lea#e the starting point to tra#el on a Great Circle route to the end point. The initial bearing is gi#en b$ the "ormula% BDEG3EE47IFA3GGFE/T7CHF.LEQ7/orth,6/orth',East,6East'88K.I788 The terminal bearing, the bearing one will be tra#elling upon arri#al at the end point, is gi#e b$ the "ormula% BDEG3EE47IFA3GGFE/T7CHF.LEQ7/orth'6/orth,,East'6East,88K.I788. 2earings are measured clockwise "rom /orth, with /orth as ( degrees, East at 0( degrees, 4outh at ,C( degrees, and 1est at '?( degrees.

S-ar putea să vă placă și