Converting/Calculating GPS cordinate ddmm.mmm format to decimal degrees

Here is a thing that i have faced few times when it comes to GPS data. Below is the GPGGA string from NMEA data receives from GPS. I have highlighted the latitude and longitude from the string.


Latitude = 0412.75469
Longitude = 07332.48758

If you want to plot this in google maps or any other platform you need to convert this data to decimal degrees, which will be easy to point the location rather than using raw data. In order to do that please follow these steps and write your own math function for this. For my purpose i am using my own function to handle the conversions.

First lets start with latitude. Get rid of the zero first.

rawdate = 412.75469  in this case 4 is the degrees which is in blue color and minutes in green

degrees = 4
minutes = rawdate - (100*degrees)
minutes = 412.75469 - (100*4)
minutes = 12.75469

So to find out the decimal degree format of raw latitude value please follow the steps bellow.

latitude = degrees + (minutes/60)
latitude = 4 + (12.75469/60)
latitude = 4.212578 
This latitude value is formatted to decimal degrees and now you can do the same for the longitude.

rawdate = 7332.48758 in this case 73 is the degrees which is in blue color and minutes in green
do the math and use google earth or map to check the coordinates are correct or not. You can write a function from Arduino, c or Python if you are using GPS with embedded systems or micro controllers.


Popular posts from this blog

Clover Display M302 hack

SIMCOM SIM900A fixed

TCP communication from NEOWAY M590E- Successful