In my map web app, I have a play pause button that show vehicle route history.I get lat lon from database and create route that vehicle traverse.
At below site go to history tab after and choose vehicle and choose play button :
http://mstrackweb.mobil-i.com
username : demo
pass : demo
for doing this i need to write javascript or openlayers can help me in animating routes of vehicle?
I create map web app with openlayers and yii php framework.
I want to show vehicle traveled route as animation like below site in my application.
http://mstrackweb.mobil-i.com
In the above site use demo/demo for login to site.In the history tab you can see traveled route of vehicles as animation.
In my app i can add markers to map after 2seconds with below code.In the history array i have lon/lat and dateTime of the vehicle as location history.
var idx = 0;
var interval = setInterval(function(){
if(idx >= history.length)
clearInterval(interval);
else{
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(
history[idx]['longitude'],history[idx]['latitude'] ).transform(
new OpenLayers.Projection("EPSG:4326"),
new OpenLayers.Projection('EPSG:900913')
),icon.clone()));
idx++;
}
},2000);
But if a marker is out of the map bound i don't know how to change the bounds of the map to showing added marker!.
how can i change bounds of the map to showing added marker?
is this approach is true? When a marker added to map create event and if this marker isn't in the map bounds change map bound to showing it.
Is there any library for showing vehicle traveled route as animation?
Best Answer
check out i2Maps here. it gives you ability of animation with a js library. in addition to this you should glance at my que here about Openlayers Animation Examples and Algorithms.
i hope it helps you...