Demo

LocationBox JavaScript Demos

Add Traffic Info (TMC) With Animation

Show:     Remove Traffic:  

Instructions

Use the "Show" button to show traffic info with flow on the map. Zoom into the map for details.
See the JavaScript API for more information.

Source Code

The Javascript code for the above map is:

<script language="Javascript" 
	src="http://www.locationbox.com.tr/locationbox/services?
	Key=key&Cmd=API&Typ=JS"></script>

<script language="JavaScript">
var mapper  = new IMapper();

function startup() {
    mapper.initMap(41.046179257461404, 29.02095794373928, 7); 
    mapper.addNavigationPanel();
    mapper.setMapListener("before_zoom_level_change", beforeZoom);
    mapper.setMapListener("zoom_level_change", afterZoom);     
    return;
}

function beforeZoom() {
    mapper.removeTrafficTmc();
}
	
function afterZoom() {
    mapper.addTrafficTmc("41,-41,42,-42,43,-43,44,-44,45,-45,46,-46,47,-47,
     48,-48,49,-49,50,-50,51,-51,52,-52"); } function show() { mapper.addTrafficTmc(); return; } function removeTraffic() { mapper.removeTrafficTmc(); }
</script>

Buttons:

  <a href="javascript:show()"><img src="images/add.gif" border=0></a>
  <a href="javascript:removeTraffic()"><img src="images/remove.gif" border=0></a>
  <a href="javascript:stopFlow()"><img src="images/remove.gif" border=0></a>

					
Download working page
Remember that you need to use your key code as Key attribute.