Jump to content

GPS code translator


JonBMN
 Share

Recommended Posts

I understand you can use the Haversine formula or Vincenty formulae but I don't even know where to begin to understand these formulas and plug in my values.

Heres what I've done incase anyone wants to see:

$Miles = sin($IniLatitude - $Latitude/2) + cos($IniLatitude - $Latitude)*sin($IniLongitude - $Longitude/2)
$Hours = $TimeElapsed/3600000
Abs($MPH = $Miles / $Hours)
ConsoleWrite($MPH & @CR)
Edited by JonBMN
Link to comment
Share on other sites

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Yes the GPS gives you the Knots which you have to convert to Miles, but it does not give you the MPH; this is what I was trying to find; and the function above gives it to you.

For your distance between the 2 coordinates its finding the straight shot. This is not what you want in a gps because you would have the true mph and coordinates which you need to have because roads are not straight shots to places; they turn and loop and go everywhere but not straight there.

Link to comment
Share on other sites

Knots is a measure of speed, not a measure of distance, so all you have to do is convert Knots to MPH, so for example $Knots = 10, $MPH = $Knots * 1.15078. You're trying to calculate distance travelled, and not the distance between two points. If you're looking to create a navigation GPS using actual routes to travel and distance based on that, good luck because that's a whole new world to explore what with road mapping and acurate maps.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

The speed that gives any GPS is very accurate as long as it is more than maybe 5 Km/h.

By the way, the straight line and bearing is what you would like to have if you are flying or sailing or walking in the bush or for me when I am in another country for the distance and bearing of my hotel or any other point that I am looking for.

Straight line and bearing is also very handy to find your car in a huge parking. There are some small GPS that do just that.

Since GPS are updating every second, you can compute the distance covered in the last second and add it to a global odometer. This would give a pretty accurate figure. Not really 100% accurate because when in a curve, it would still compute only the straight line distance of that second but so close anyway. It could possibly beat some cars odometer accuracy.

For the distance left to cover on a road, this is another ball game. Personnaly I calculate around 1.3 times the distance of the straight line. But this is not accurate at all. To get accuracy would require some huge databases and lots and lots of programming. You could also use Google to get the road distance and input it to the app before starting then substract this from the distance covered. I wonder how accurate it could be.

Google road distance to Anchorage airport from Montreal is 6716 Km. The aerial distance is 5026 Km. The road distance is then 1.34 times the aerial distance.

Edited by AlainB
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...