Page 2 of 21

Journey Recording using GPS Tracking

Posted: Tue Apr 23, 2013 10:41 am
by Maryna Brodina

Hi Joe,

please check here http://www.movable-type.co.uk/scripts..., should help


Journey Recording using GPS Tracking

Posted: Tue Apr 23, 2013 12:39 pm
by Joe Paisley

Thanks! That does help a little. Math isn't my strong skill (and I thought programming would be fun, silly me).
That definitely makes more sense to me than the Wikipedia link that Katya gave me, but I'm not exactly sure how to incorporate it. I don't need all of those calculations, do I? Which do I need to include?

Also, will this calculate distance from point to point, or along a path? If I ride my bike in a loop, or along a curvy road, will it still calculate time/disance/speed accurately?


Journey Recording using GPS Tracking

Posted: Tue Apr 23, 2013 2:15 pm
by Kateryna Grynko

Hi Joe,

You would need to write an app that calls Geolocation Service every few seconds (for example 5-10).
In localeStorage you can store previous coordinates (latitude and longitude), the total distance travelled, total time.

After each call Geolocation you should:
1) calculate the distance from the previous location to the current
2) increase the total distance traveled by the distance obtained above
3) increase the total time counter
4) record the current position in the localeStorage instead of the previous coordinates.

Average speed in each moment is (total distance / total time).


Journey Recording using GPS Tracking

Posted: Tue Apr 23, 2013 2:46 pm
by Joe Paisley

Exactly! So how do I write the javascript to call geolocation at a 5 to 10 second interval? How do I record that into localStorage, and how do I write the javascript so those equations are included and calls upon previously stored data? I'm sorry I'm not much more help, but that is exactly what I would love to learn how to do.


Journey Recording using GPS Tracking

Posted: Tue Apr 23, 2013 2:47 pm
by Joe Paisley

Also, on a less important note, later, I would like to incorporate elevation per this interval as well.


Journey Recording using GPS Tracking

Posted: Tue Apr 23, 2013 10:36 pm
by Illya Stepanov

Hi Joe - we will need some time to think how best to do it. We'll update soon.


Journey Recording using GPS Tracking

Posted: Tue Apr 23, 2013 10:47 pm
by Joe Paisley

You are all the best!


Journey Recording using GPS Tracking

Posted: Wed Apr 24, 2013 2:44 pm
by Joe Paisley

Would something along these lines be useful?
codefunction autoUpdate() {
navigator.geolocation.getCurrentPosition(function(position) {
var newPoint = new google.maps.LatLng(position.coords.latitude,
position.coords.longitude);

if (marker) {
// Marker already created - Move it
marker.setPosition(newPoint);
}
else {
// Marker does not exist - Create it
marker = new google.maps.Marker({
position: newPoint,
map: map
});
}

// Center the map on the new position
map.setCenter(newPoint);
});

// Call the autoUpdate() function every 5 seconds
setTimeout(autoUpdate, 5000);
}

autoUpdate();
/code


Journey Recording using GPS Tracking

Posted: Wed Apr 24, 2013 4:41 pm
by Kateryna Grynko

Hi Joe,

We're working on it. We'll test and update tomorrow.


Journey Recording using GPS Tracking

Posted: Wed Apr 24, 2013 4:43 pm
by Joe Paisley

Thanks!