![]() |
GPS, NMEA, WGS-84, GIS and VB.NET By Thomas Tingsted Mathiesen (tma@tma.dk) I made this page because I have almost surfed my self to death trying to piece all the different information together - It's out there, but somewhat scattered all over. My goal is to develop a VB.NET class library where all functionality conserning positioning, Datum conversion, Grid transformation and direct serial interface to an external USB/Serial GPS reciever. My Linked-In profile My company - Gaudio ApS My FaceBook profile |
![]() |
|
| Last changes made: 16 JUL 2008 | |||
|
|
|
| NMEA(WGS-84) | 5601.0318,N 01211.3503,E |
| Decimal format | 56.01755 12.19302 |

| Name | Link |
| National Geophysical Data Center(NGDC) | http://www.ngdc.noaa.gov/seg/geomag/jsp/struts/calcDeclination |
| GLOSSARY OF GPS TERMINOLOGY | http://www.rbf.com/cgcc/glossary.htm |
| Wikipedia's story on Magnetic declination | http://en.wikipedia.org/wiki/Magnetic_variation |
| NMEA Sentence information | http://www.tma.dk/gps/nmeastrings.htm |
| Deviation (Graphs) | http://swepos.lmv.lm.se/english/sa.htm |
| Google groups on the subject | http://groups.google.dk/group/Google-Maps-API/browse_thread/thread/7b36c0f8b6a0d592/ab5580ea1b6adaaf?lnk=st&q=convert+NMEA+to+WGS-84+decimal&rnum=2&hl=da#ab5580ea1b6adaaf |
| Jim Mischel's fantastic article on 'Computing Track Information in GPS' | http://www.informit.com/guides/content.asp?g=dotnet&seqNum=513&rl=1 |

| Date | Name | Rate | Message | Homepage |
| 06-03-2010 | Shameem | 9 | Hi Mr Mathiesen,Im writing an app in vb6.how do i get to show my small vehicle icon at my gps location,just like u have the red dot on yours in google earth.Im referencing the googleearth.exe in my project.
Thanx for any assistance. | |
| 24-02-2010 | 9 | |||
| 23-02-2010 | 9 | |||
| 20-02-2010 | 7 | |||
| 17-11-2009 | 9 | |||
| 28-10-2009 | Artur | 9 | very useful | www.matematyka-blog.info |
| 04-08-2009 | MMasri | 9 | ||
| 19-07-2009 | Johnn | 9 | ||
| 15-07-2009 | 9 | |||
| 02-05-2009 | Kevin | 9 | Excellent Application Thomas. | |
| 31-03-2009 | John | 9 | ||
| 09-03-2009 | zadania domowe | 8 | thanks | www.trudne.pl |
| 01-03-2009 | Chris | 8 | Looks good but I cannot register the DLL in Windows Vista. The msg from regsvr32 is The module tmagpsapi.dll was loaded but the entry-point DllRegisterServer was not found. Any ideas please? | |
| 17-02-2009 | James | 9 | This page has been great in helping build an autoilot for my rc plane. | |
| 12-02-2009 | 7 | |||
| 12-02-2009 | Rickard | 9 | Sweet code! =) I had helped me with quite some stuff over the past month. Thanx alot. | www.virtualpunk.com |
| 09-01-2009 | Medhat Dessouki | 9 | Very good work, efforts & Info.
Well done. | m_dessouki2002@yahoo.com |
| 31-12-2008 | Rasmus | 8 | Tusen tack Thomas. All information på ett och samma ställe. | |
| 02-12-2008 | Chris | 9 | Great work here. Do you by chance have or know where to get the formula to convert from WGS84 to SPCS83 ? | www.caroneast.com |
| 01-12-2008 | Raman | 9 | Thomas, thank you so much for your efforts and hardwork to put together all.
I am learning and novice programmer. I wanted to implement RealTime Distance caluculation, when I connect to my LapTop thru COM port. how can I do that? Can you give me some thoughts and suggestions please. | |
| 01-12-2008 | vpolv | 9 | thanks.
The info you provide is excellent and easy to understand.. thanks again... | |
| 01-12-2008 | vpolv | 9 | thanks.
The info you provide is excellent and easy to understand.. thanks again... | |
| 25-10-2008 | 9 | |||
| 07-10-2008 | David Leach | 8 | In the NMEA to Decimal function, you need to check and convert to positive number before the calculations (FLOOR) are started. Other wise the floor of -9.5 returns -10 and the rest of the calculation gets off by 1. I also took off the first part that strips and replaced the . with a ,. It didnt seem to work as you intended and caused the whole string to look like a giant integer and wasnt necessary with my data anyway.
Private Function toDecimal(ByVal Pos As String) As Double Pos=5601.0318 Dim PosDb As Double = CType(Replace(Pos, ., ,), Double) Replace . with , (Used in danish doubles) Dim negbool As Boolean If (Pos 0) Then negbool = True Dim PosDB As Double = Math.Abs(CType(Pos, Double)) Dim Deg As Double = Math.Floor(PosDB / 100) Dim DecPos As Double = Math.Round(Deg + ((PosDB - (Deg * 100)) / 60), 5) If negbool Then Return -DecPos Else Return DecPos =56.0172 End If End Function | |
| 25-09-2008 | 7 | |||
| 15-07-2008 | Luca | 9 | Hi Thomas,
very useful page, thankyou! But I think there may be something wrong in DecimalPosToDegrees (or something I didnt understand): the NMEA result WITHSIGNS you show (56°13.18N) seems not to be correct since the WGS84 format value is 5601.0318 (where .0318 are decimal of minutes, not seconds). Moreover, in the NMEA output format case statement, the function should convert seconds to decimal of minutes. Am I wrong? Thank you again. Luca Hi Luca, I will check up on it.. Thanks... /Thomas | |
| 02-07-2008 | winbell@hotmail.com | 9 | good job | |
| 20-06-2008 | Jesus | 9 | Hi, Thomas.
Thank you very much for your article, has helped mae a lot. Just one (maybe obvious) note. To convert Longitude you have to take the three first digits, as degress, while in Latitude you only take the first two ones. It has take a little bit to me to realize why I do not get the rigth Longitude. Thank you again. Jesus. | |
| 14-06-2008 | Nicola | 9 | wow | |
| 12-06-2008 | Gaurav Agrawal | 7 | Article is excellent.could anyone give me source code for conversion from NMEA format(WGS84) to Meter Format(British National grid map) or Decimal to Meter conversion. | |
| 11-06-2008 | 9 | just what I was looking for! | ||
| 19-05-2008 | Alex | 9 | very very good
| |
| 15-05-2008 | Yael | 9 | Thank you very much | |
| 08-05-2008 | nikos | 9 | Thank you Very Match | |
| 22-03-2008 | dzwonki | 7 | thx | www.dzwonker.pl |
| 05-03-2008 | andrew | 7 | Brilliant, thanx a lot !
You dont by any chance also have a function for calulating a new posision given a position and a distance ? /andrew Hi Andrew No, sorry I haven't got that formula, but if you or anybody else in here knows of one I would very much like to post it here. /Thomas Mathiesen | |
| 03-03-2008 | N. Tabatabai | 7 | Hi Thomas, first of all, Im happy to see developers helping each other. Information I get, was so helpfull and Exactly what I need. thank you | |
| 21-02-2008 | Joachim | 9 | Hi Thomas, very usefull information, thank you.
Dont know if Im wrong, but: the GPS spec is nutty ... since there are only 90 degrees of latitude and 180 degrees of longitude the latitude values in degrees never have 3 digits ... so the spec for latitude is: ddmm.mmmm and longitude is: dddmm.mmmm In DecimalPosToDegrees you always add 3 zeros, this can cause problems | |
| 11-02-2008 | Bek | 9 | Thank you very much, Thomas Mathiesen !!!! | |
| 02-02-2008 | 8 | |||
| 12-01-2008 | Azad | 9 | Hi Thomas,
This is absolutely a great stuff. You said for Western and Southern hemispheres multiply with -1. So I have to change the source code if I change hemispheres? And is there any separate source code file for the dll? Hi Azad, No you don't have to change the code when changing hemisphere. With regars to the sourcecode of the tmagpsapi.dll, I do not wish to share this (Write me on tma tma.dk if you whant an explanation why)
Kind regards. Thomas Mathiesen | |
| 03-01-2008 | max | 9 | :) i like
very helpful (i am writing a program which processes Navman gps data logs :D) | |
| 13-12-2007 | N. V. Jensen | 9 | Det var lige hvad jeg manglede. | nvjensen.dk |
| 05-12-2007 | hnguyen | 7 | great Job. Anyway, the decimal format is not correct, should be xx.xxxxx for Lat and yyy.yyyyy for Lon
Please change and notice your update Appreciate it Thanks Thomas | |
| 26-11-2007 | Rob | 9 | Great, was looking for this info a long time | |
| 30-10-2007 | Dan | 9 | Thanks for the help. Really great stuff with the Calculate distance and direction in degrees between two coordinates | |
| 01-10-2007 | 9 | |||
| 18-09-2007 | 8 | |||
| 18-09-2007 | Isaac | 9 | FANTASTIC!! Thanks so much! Really Great stuff! | |
| 11-09-2007 | B. | 9 | You are the MAN..!!
Good to see developers helping each other :) | |
| 05-09-2007 | Peter | 9 | Great collection of useful information and a nice API as well! | |
| 21-08-2007 | Cranesfreak | 8 | The info you provide is excellent and easy to understand | |
| 16-08-2007 | Fred | 1 | You wrote this huge error:
Longitude is the Y axis (north-South) - False Latitude is the X axis (West-East) - False Please change also your worldmap picture... The real definition is the opposite! Latitude gives the location of a place on Earth north or south of the equator. Longitude is the east-west geographic coordinate. Jesus - you are right Fred - Must have been sleeping that day, sorry about that - I have removed it. (Update will follow) Thanks Thomas Mathiesen | |
| 14-08-2007 | Andreas | 9 | Excellent Page with most useful information collected on one website! Thx a lot. | |
| 08-08-2007 | 9 | |||
| 02-08-2007 | Rosli | 9 | I try to fine conversion between wgs84 to local coordinates software for all countryplease help me for my problem | liroii@yahoo.com |
| 26-07-2007 | Derrick | 9 | Good work Thomas and thank you. I was going nuts trying to understand why Google Earth decimal would not work with my NMEA output. | |
| 15-07-2007 | 7 | |||
| 01-07-2007 | Harikumar | 8 | Very good collection of most important codes for customised GPS /embedded GPS software developers | |
| 23-06-2007 | Can | 9 | After searching some minutes I ended up with this wonderful page. All I need to know was here. Thank you Thomas. | |
| 21-06-2007 | Paul H-T | 8 | I translated this info Excel functions, but my result was around 2000 km, when it should be under a km! Do you have an Excel version of these formulas available? I have some sample data and the formulas in a file that I could send to someone to double check. | www.iwireless.com |
| 14-05-2007 | rexSalius | 9 | Wonderful site, Thomas. Why didnt I find it earlier.... -)
Thanks | |
| 12-05-2007 | David | 9 | Thank you very much for this info. It is very usefull and it avoided me to expend a lot of time in analyze. Thank you again Thomas. | |
| 09-05-2007 | Randy | 9 | Wonderful... !!!
Is the GPS Infromation app available. I would like to look at the drift of my GPS unit. | |
| 06-05-2007 | Javier | 6 | Thomas, I cant connect my usb garmin gps, any suggestions ? Hi Javier I have not testet the software on Garmin (Don't have one) - so if any of you could send me some raw Garmin GPS data I will try to support it. - Thomas Mathiesen | www.netgis.com.ar |
| 04-05-2007 | Rick C. | 9 | Do you have any examples for geofencing calculation? Hi Rick No, I have not, but the subject is exciting, and I will look into it. Are you looking for ways to calculate when the position is outside a circle or shape? Regards -Thomas Mathiesen | |
| 01-05-2007 | Robertr Brenner | 8 | Amazing what love for a hobby can create! | |
| 15-04-2007 | 9 | |||
| 14-04-2007 | Malcolm Haines | 7 | Its great to see all this info together. i too almost surfed myself stupid trying to piece it all together.
Thanks Thomas! | |
| 19-03-2007 | Aleksander Posmyk | 9 | lot of useful information. thx
| posmyk.info |
| 19-03-2007 | 9 | |||
| 10-03-2007 | Maksim Sviatlitski | 9 | Thomas, thank you so much for your efforts! This page was exactly what I was looking for! | www.agile-sys.com |
| 28-02-2007 | Adam OConnor | 9 | Absolutely Exceptional | |
| 02-01-2007 | 9 | |||
| 01-01-2007 | 9 | |||
| 24-12-2006 | 9 | |||
| 22-12-2006 | Nasrullah | 8 | Lot of Thanks | www.4bgroup.com |
| 15-12-2006 | Ubi Sumus | 6 | DecimalPosToDegrees has a tiny bug. In Germany we use , for decimal separator not a . NMEA gets confused by an additional ,
We use ,(comma) for decimal seperation as you do, that is why I replace the .(dot) with a ,(comma) - Thomas | |
| 11-12-2006 | 8 | |||
| 09-12-2006 | LazBoy | 8 | Thanks a billion!!
Very informative page. | |
| 27-11-2006 | landofshadows | 7 | What I was after was how to make an Excel forumla to convert Latitude & Longitude into a English Postcode... You see we have the Cordinates but need to see the location by postcode... and at the moment I am having to check them one at a time, 1,500 per day... any one able to help me email me please landofshadows lycos.co.uk (Subject GPS) | |
| 27-11-2006 | 7 | |||
| 24-11-2006 | 9 | |||
| 15-11-2006 | 9 | |||
| 14-11-2006 | 9 | Thanks for your nice work. | ||
| 27-10-2006 | 9 | |||
| 16-10-2006 | Leonardo | 5 | Nice page,
but, I think that in GPGGAs lat/lon the minutes are in radians, but the value after the comma means the decimal part of the minutes, not the seconds. see http://aprs.gids.nl/nmea/#gga Try the formula:DEGREES+(MINUTES+/60) - 56+(01.0318/60) in your example you are likely to get beter results leonardo(at)novageo(dot)pt -Thank you Leonardo, I have corrected the formula/Thomas Mathiesen | |
| 15-10-2006 | 7 | Unfortunatly the link http://www.gpsinformation.org/dale/nmea.htm isnt working
- Is up again/Thomas Mathiesen | ||
| 11-10-2006 | 6 | good work.. | ||
| 09-10-2006 | 5 | |||
| 06-10-2006 | 9 | Ive been looking for this information for some time now, thank a lot guys the content is great. | ||
| 04-10-2006 | 9 | |||
| 01-10-2006 | 9 | Very nice... Had some useful info :) | ||
| 06-09-2006 | 9 | |||
| 29-08-2006 | Peter Cranstone | 9 | Great job. Exactly what we needed.
Peter.Cranstone 5o9inc.com | |
| 14-08-2006 | 8 | Thanks. This realy helped me a lot. | ||
| 09-08-2006 | 9 |
|
| I know the above list might be "annoying", but it does help you find the content of this page, so bare with me.. |