GPS Co-ordinate conversion to distance in VB
Posted on 2006-05-24
Sorry, bit of a newbie as far as GPS is concerned.
I'm trying to calculate the distance between two sets of GPS co-ordinates.
I can strip the data from a Serial GPS in NMEA format using the sentence RMC.
This gives me Latitude in ddmm.sssss and Longitude in dddmm.sssss.
I can store 2 of these value pairs somewhere and I then need to calculate the distance between the two.
I've looked at all of the formula's and arithmetic out there via google and on EE, but what I actually want is a function that I can just drop into my program in vb.net as some of the maths is quite complicated, and it's about 10 years since I did anything involving sin / cos functions, so 500 points are available if anyone can write the function for me !
The ideal function will take the GPS data in it's raw format and output the distance in metres and can be written in either c# or vb.net.
I'm not interested in trajectory or time, just pure distance between 2 points.
And the accuracy over distance is not a problem, as distances will not be more than 600 yards. (So you can assume that the earth is flat in your calculations!)
Something like this
Function DistanceBetweenCoOrdinates(NMEACoordLat1 as string, NSIndicator1 as string, NMEACoordLong1 as string, WEIndicator1 as string, NMEACoordLat2 as string, NSIndicator2 as string, NMEACoordLong2 as string, WEIndicator2 as string) as Double
' **** Insert code here ****