NAVIGATION
Home
Gallery
Java
Linux
Web
Scripts And Utilities
Mobile And Sms
Misc
Contact
pixelWIKI
Nabaz Tag




<<

Converting Gps Coordinates

see here for more.

GPS Coordinates come in 4 main flavours:
  1. Decimal degrees, e.g. 40.04
  2. Degrees and decimal minutes, e.g. 40, 2.4
  3. Degrees, minutes and decimal seconds, e.g. 40,2,24
  4. NMEA format - see below

Conversion

VERY IMPORTANT NOTE In all these conversions, you should ignore the sign (+ or -) until the final value
SECOND VERY IMPORTANT NOTE Java and .NET developers - store degrees as a double not an int, as an int cannot store negative 0, which is VERY important

D = integer degrees
d = decimal degrees
M = integer minutes
m = decimal minutes
S = integer seconds
s = decimal seconds
(int) = convert to an integer (remove any decimal places, e.g. 5.67 becomes 5)

Decimal Degrees to Degrees, Minutes and decimal Seconds - d to D, M, s
D = (int) d
M = (int) ( ( d - D ) x 60 )
s = ( d - D - ( M/60 ) ) x 60


Decimal Degrees to Degrees and decimal Minutes - d to D, m
D = (int) d
m = ( d - D ) x 60


Degrees, Minutes and decimal Seconds to decimal Degrees - D, M, s to d
d = D + M/60 + s/3600


Degrees, Minutes and decimal Seconds to Degrees and decimal Minutes - D, M, s to D, m
D = D
m = M + s/60


Degrees and decimal Minutes to decimal Degrees - D, m to d
d = D + m/60


Degrees and decimal Minutes to Degrees, Minutes and decimal Seconds - D, m to D, M, s
D = D
M = (int) m
s = (m − M) × 60



NMEA format
The NMEA (National Marine Electronics Association) format is that typically received from GPS units. It has the following format:
DDmm.mm,H
where H is the hemisphere (N(orth), S(outh), E(ast) or W(est)

So the NMEA format is ( Degrees * 100 ) + decimal Minutes. To convert NMEA to decimal Degrees:
D = (int) ( NMEA / 100 )
m = NMEA - D

at this point, any of the equations above can be easily applied.


GPS Accuracy (thanks to offroaders.com

  Latitude Longitude
1 degree 69 miles 42 miles
1 minute 6072 ft 3696 ft
1 second 101.2 ft 61.6 ft
 
Decimal Degrees
0.1 36432 ft 22176 ft
0.01 3643.2 ft 2217.6 ft
0.001 364.32 ft 221.76 ft
0.0001 36.43 ft 22.18 ft
0.00001 3.64 ft 2.22 ft
0.000001 4.37 In 2.66 In
0.0000001 0.44 In 0.27 In