PDA

View Full Version : lat lon conversion from mappoint format back to gps sentence



Anonymous
09-09-2002, 09:40 PM
I use the following to convert from nmea gps format to mappoint format.

How would I convert back?

Public Function ConvertNMEA(sNMEA As String) As Double
'expects N47.36981 from GPS sentence
'returns -47.61635 mappoint format

On Local Error Resume Next

Dim sTmp As String
Dim dRetVal As Double

sTmp = Left(sNMEA, 1)

sNMEA = Mid(sNMEA, 2)

dRetVal = Int(sNMEA / 100) + (sNMEA - Int(sNMEA / 100) * 100) / 60

'add + -
Select Case sTmp
Case "N"
'nothing or +
Case "S"
dRetVal = "-" & dRetVal
Case "E"
'nothing or +
Case "W"
dRetVal = "-" & dRetVal
End Select

ConvertNMEA = dRetVal

End Function

Eric Frost
09-10-2002, 12:42 PM
Please provide examples of the strings.. also, see Evert Mouw's article: http://www.mp2kmag.com/articles.asp?ArticleID=75 That may be of help..

keywords: lat/lon, latitude, longitude, gps, nmea, string format, convert