# Geographic coordinate conversion

Geographic coordinate conversion

Geographic coordinates consist of latitude and longitude. There are many ways of writing coordinates, and converting between the different ways is non-obvious but also quite trivial.

Ways of writing coordinates

All of the following are valid and acceptable ways to write geographic coordinates:

* 40:26:46N,79:56:55W
* 40:26:46.302N 79:56:55.903W
* 40°26'21"N 79°58'36"W
* 40d 26' 21" N 79d 58' 36" W
* 40.446195N 79.948862W
* 40.446195, -79.948862
* 40° 26.7717, -79° 56.93172

Coordinates here are generally written as coord|40|26|21|N|79|58|36|W|.

Basic forms

There are three basic forms of a coordinate.

# Coordinate containing degrees (integer), minutes (integer), and seconds (integer, or real number) (DMS).
# Coordinate containing degrees (integer) and minutes (real number) (MinDec).
# Coordinate containing only degrees (real number) (DegDec).

All forms of coordinates are capable of representing the same amount of data and the same precision. Depending on which type of coordinate you are provided with, and which type you would like to work with, you may have to do some conversion.

Components of a typical coordinate

In its most simple form a coordinate is just a number of degrees. The tricky part comes in when you need to differentiate North/South latitude or West/East longitude, or make the number more digestible by writing it with minutes and seconds instead of as a decimal number.

Degrees

The degrees portion of the coordinate is always going to be the easiest to figure out. The degrees is always the left-most whole number. For example:

40:26:46N 40 W87°43'41 87

A sphere is divided into 360 degrees. The number space is divided into two halves, East and West in the case of longitude and North and South in the case of latitude. The maximum ranges are as follows:

Longitude 180 W = -180 180 E = 180

Latitude 90 N = 90 90 S = -90

Technically you could have latitudes greater than 90 or less than -90, but this is an ambiguous case, since there would be an equivalent coordinate with an inverse longitude.

The minimal case is that you have only degrees:

50.21389 or 50.21389N

Minutes

Minutes are an optional component, as is implied by the minimal case of degrees. If there is no minutes component, the degrees component contains the entire precision of the coordinate and there must not be a seconds component. Minutes are actually the numerator component of a fraction with denominator 60 of one degree.

With the same examples as above:

40:26:46N 26 W87°43'41 43

In the first case, the number of minutes is 26.

econds

Seconds are also an optional component, and can only exist if the minutes component also exists. Seconds are the numerator component of a fraction with denominator 60 of one minute.

40:26:46N 46 W87°43'41 41

In the second case, the number of seconds is 41.

To convert, 41 seconds is equal to minutes.

Putting it all together

Conversion from DMS to Decimal Degree

Given a DMS coordinate such as W87°43'41", it's trivial to convert it to a number of decimal degrees using the following method:

* Calculate the total number of seconds, 43'41" = (43*60 + 41) = 2621 seconds.
* The fractional part is total number of seconds divided by 3600. 2621 / 3600 = ~0.728056
* Add fractional degrees to whole degrees to produce the final result: 87 + 0.728056 = 87.728056
* Since it is a West longitude coordinate, negate the result.
* The final result is -87.728056.

Conversion from Decimal Degree to DMS

Given a decimal longitudinal coordinate such as -87.728055 it is trivial to convert it to DMS form. It will be necessary to know whether it is a latitudinal or longitudinal coordinate in order to fully convert it. The method is as follows:

* Subtract the whole number portion of the coordinate, leaving the fractional part. The whole number is the number of degrees. 87.728055 = 87 degrees.
* Multiply the remaining fractional part by 60. This will produce a number of minutes in the whole number portion. 0.728055 x 60 = 43.6833 = 43 minutes.
* Multiply the fractional part of the number of minutes by 60, producing a number of seconds. 0.6833 x 60 = 40.998 = 41 seconds. It is possible to count this as 40 seconds, truncating the decimal, round it to 41, or keep the entire number.
* Depending on whether the source number was a latitudinal or longitudinal coordinate, and the sign of the number, add the N/S/E/W specifier. The following table shows the possibilities:

Type Dir. Sign Test Lat. N + > 0 Lat. S - < 0 Long. E + > 0 Long. W - < 0

A coordinate with at 0°0'0" latitude or longitude is neither North nor South, East nor West. It is simply zero latitude or zero longitude.

* The final result is: W 87°43'41".

Programmatical conversion

The most common programmatical use of these processes is to display a coordinate to an end user in the more common DMS form instead of decimal form. Below is a piece of pseudocode to convert from degrees to degrees, minutes, and seconds:

function deg_to_dms ( degfloat ) "Input must be non-negative:" if degfloat < 0 error end if "Compute degrees, minutes and seconds:" deg &larr; integerpart ( degfloat ) minfloat &larr; 60 * ( degfloat - deg ) min &larr; integerpart ( minfloat ) secfloat &larr; 60 * ( minfloat - min ) "Round seconds to desired accuracy:" secfloat &larr; round( secfloat, digits ) "After rounding, the seconds might become 60. These two" "if-tests are not necessary if no rounding is done." if secfloat = 60 min &larr; min + 1 secfloat &larr; 0 end if if min = 60 deg &larr; deg + 1 min &larr; 0 end if "Return output:" return ( deg, min, secfloat ) end function

ee also

* [http://jeeep.com/details/coord/ Coordinate Translation] (conversion doesn't currently seem to work)
* [http://www.fcc.gov/fcc-bin/convertDMS Converter from the National Geodetic Survey] (degrees, minutes, seconds to/from decimal degrees)
* [http://www.satsig.net/degrees-minutes-seconds-calculator.htm Converter to decimal degrees]
* [http://joehohk.0fees.net/Location.htm Latitude and longitude converter]
* [http://geography.about.com/library/howto/htdegrees.htm How to Convert decimal degrees into degrees, minutes, seconds] - Info about decimal to sexagesimal conversion
* [http://member.melbpc.org.au/~bhelem/ MapDot Protocol] A method to convert geographic coordinates into a sequence
* [http://www.gpsies.com/coordinate.do GPSies.com] Latitude and longitude converter with automatically format detection (e.g. N 52°27'11.512" or N 52°27.191' or 52.4531977 doesn't matter). Shows result on Google Maps.

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• Geographic coordinate system — Map of Earth showing lines of latitude (horizontally) and longitude (vertically), Eckert VI projection; large version (pdf, 3.12MB) …   Wikipedia

• Coordinate system — For geographical coordinates on Wikipedia, see Wikipedia:WikiProject Geographical coordinates. In geometry, a coordinate system is a system which uses one or more numbers, or coordinates, to uniquely determine the position of a point or other… …   Wikipedia

• Celestial coordinate system — For other uses of Celestial , see Celestial (disambiguation). Orientation of Astronomical Coordinates Orientation of the galactic, ecliptic and equatorial coordinate systems, projected on the celestial sphere, showing the galactic equator (black) …   Wikipedia

• Universal Transverse Mercator coordinate system — The Universal Transverse Mercator (UTM) coordinate system is a grid based method of specifying locations on the surface of the Earth. It is used to identify locations on the earth, but differs from the traditional method of latitude and longitude …   Wikipedia

• Horizontal coordinate system — The horizontal coordinate system is a celestial coordinate system that uses the observer s local horizon as the fundamental plane. This conveniently divides the sky into the upper hemisphere that you can see, and the lower hemisphere that you… …   Wikipedia

• Galactic coordinate system — Artist s depiction of the Milky Way galaxy, showing the galactic longitude relative to the sun. The galactic coordinate system (GCS) is a celestial coordinate system which is centered on the Sun and is aligned with the apparent center of the… …   Wikipedia

• Latitude — This article is about the geographical reference system. For other uses, see Latitude (disambiguation). Map of Earth Longitude (λ) Lines of longitude appear vertical with varying curvature in this projection, but are actually halves of great… …   Wikipedia

• Ordnance Survey National Grid — For the electricity network, see National Grid (Great Britain). Geodesy Fundamentals …   Wikipedia

• Longitude — For Dava Sobel s book about John Harrison, see Longitude (book). For the adaptation of Sobel s book, see Longitude (TV series). Map of Earth Longitude (λ) Lines of longitude appear vertical with varying curvature in this projection, but are… …   Wikipedia

• Irish Transverse Mercator — (ITM), is the new geographic coordinate system for Ireland. It was implemented jointly by the Ordnance Survey of Ireland (OSI) and the Ordnance Survey of Northern Ireland (OSNI) in 2001. The name is derived from the Transverse Mercator projection …   Wikipedia