Andrew: I just implemented this myself and found a bit of an issue.
Calls to getCurrentPosition() are highly inaccurate, if you have not recently used GoogleMaps or are on a SkyHook Network Node. I found this out, while taking the dog for a walk in the park. Droid was Spot on, but the iPhone stayed at the house or the cell tower. This morning I discovered that watchPosition() worked like a charm. You may want to go with that. -Dylan On Dec 27 2009, 2:45 pm, Andrew Hedges <[email protected]> wrote: > Here is a simple example page you can use as a starting point for > browser-based geolocation: > > http://segdeha.com/w/geolocation.html > > To track speed, you would need to track your location over time. > Easiest might be to set up a setInterval call to get the location > every few seconds and save it to an array. Something like the > following (untested): > > var readings = []; > setTimeout(function () { > navigator.geolocation.getCurrentPosition(function(position) { > readings.push(position.coords); > }); > > }, 10000); // repeat every 10 seconds > > Once you have your readings, here is a script that may be helpful for > finding distances based on Latitude/Longitude: > > http://segdeha.com/e/haversine/ > > Good luck! > > On Dec 27, 11:27 pm, tzenobite <[email protected]> wrote: > > > > > many thanks! i will try asap (now i'm in trouble with a 'if' loop)
-- You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/iphonewebdev?hl=en.
