On Saturday, October 15, 2011 1:32:42 PM UTC+2, Kasper wrote:
>
> I, unfortunatly, am not familiar with javascript...
>

:( then I suggest you to invest some time and read more about it, is an 
important prerequisite if you want to go in advanced topics as animating 
marker along a polyline. 
 

> *-How did you build your routes and stations?
> *


I digitized (manually) the whole swiss railway network then exported the 
vectors in two places
- Fusion Tables - which I am using just to display the network (the red dot 
and lines)
- Encoded polylines 
- 
https://github.com/vasile/vehicle-simulator/blob/master/static/js/edges_encoded.js
 
- content of this file is used for building the vehicle routes
 

> *-(How) did you cache the planned routes? (assuming that is the way you 
> get the arrival and departure dates)
> *


Based on the timetables I know in which stations a vehicle stops, so having 
the network I can pre-compute what elements of the network are needed to 
follow that route. This I did using simple graph algorithms, i.e. Dijkstra. 
The output is then a simple list of polyline ids that are needed to build a 
route. Check the "edges" section of the README 
here https://github.com/vasile/vehicle-simulator/
 

> *-How did you animate the markers across the polylines?*


Well, being just a simulation and knowing the routes and the timetables all 
you have to do is to see how much time passed since last station and how 
much time left. Knowing these and the route geometry between the two 
stations, you can project a point along a polyline at given percent. The 
"magic" is in linesPool.positionGet() 
from https://github.com/vasile/vehicle-simulator/blob/master/static/js/map.js 
. 

Regarding this feature, I asked for a feature request, feel free to star it 
to get prioritized :) http://goo.gl/P0exk

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/xeu6y1F1k74J.
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/google-maps-js-api-v3?hl=en.

Reply via email to