GPS data meaning

gps

I got this data from GPS module.

$GPRMC,235316.000,A,4003.9040,N,10512.5792,W,0.09,144.75,141112,,*19
$GPGGA,235317.000,4003.9039,N,10512.5793,W,1,08,1.6,1577.9,M,-20.7,M,,0000*5F

What is the meaning of these code ? How to get Latitude and longitude and how to convert that value to add GOOGLE map. I think GOOGLE map accept Decimal degree value.

Best Answer

Once you've read the NMEA sentence details as per David's answer and parsed them you can use code like the following to convert to decimal degrees:

double lat, lon;
int degrees;

lat = atof(RMC.latitude);
lon = atof(RMC.longitude);
degrees = (int) (lat / 100);
lat = (double) degrees + (lat - degrees * 100) / 60.0;
degrees = (int) (lon / 100);
lon = (double) degrees + (lon - degrees * 100) / 60.0;
if (RMC.NS_ind == 'S')
  lat = 0.0 - lat;
if (RMC.EW_ind == 'W')
  lon = 0.0 - lon;
Latitude = lat;
Longitude = lon;