1

I have a database with information about where an individual is geographically (lng, lat, alt) located at periods of time, that I want to represent graphically using Google Maps and JavaScript. There needs to be functionality to allow the user to adjust the 'play back' speed such as using a slider.

How am I best to do this, my thoughts were as follows:

  • Use an ajax request to pull a JSON file
  • Iterate through this client side, one step at a time
  • Draw marker on the Google Map, set an interval timeout and repeat.

Problem is the location updates may not be regular, so we could have one update at say 8AM, followed by an update at 8:05AM but then not receive an update until 10AM whats best to do about this? Insert psuedo locations in the JSON to predict where the user may be? This seems quite messy, was wondering if anyone had a better idea for implementation. Also drawing markers and removing them seems quite counter productive, can I feed Google maps my data to seamlessly transition between points?

Many Thanks.

1 Answer 1

0

You somehow have to fill in the gaps between data points. If you assume that the user traveled a straight line between two updates at constant speed, you could use the Elevation Service to divide the path into a set number of equal-distant points. That will fill in the gaps.

If you need to follow a road, you would first have to calculate the route by road between two data points, then use the Elevation Service to divide the road path into equal-distant points.

See the Snap to Road example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.