GPS

I’ve always wanted to learn how to convert GPS coordinates without “knowing”, like it should be common sense. I came across a pair of coordinates, both the DMS and the DD formats and decided to start breaking things down.

DMS, or Degrees/Minutes/Seconds is a way to express GPS as divisions of 60 minutes and 60 seconds. The earth is 12,756km at the equator, so every degree would be 35.43km, every minute would be 590m, and every second should be 9m. An example would be 28°32′58″N 84°33′43″E

DD is Decimal Degrees and is an easier way to express GPS fine-tuned portions of the Degree by using fractional digits. An example would be 28.54944°N 84.56194°E

Converting from DMS to DD appeared to be quite easy:

32 / 60   = 0.5333333333333333
58 / 3660 = 0.0161111111111111
   +      = 0.54944

33 / 60   = 0.55
43 / 3600 = 0.0119444444444444
   +      = 0.56194

Converting from DD also presented little challenge:

0.54944 * 60 = 32.9664 -> FLOOR() -> 32
32.9664 - 32 = 0.9664
0.9664 * 60  = 57.984 -> ROUND() -> 58

0.56194 * 60 = 33.7164 -> FLOOR() -> 33
33.7164 - 33 = 0.7164
0.7164 * 60  = 42.984 -> ROUND() -> 43

A small javascript converter would look like this:

DMS <-> DD
DMS/Degree:
DMS/Minute:
DMS/Second:
DD/Decimal:

Leave a Reply