TimeType Enumeration

Bing
 

Defines the transit time type.

Name

Description

arrival

The time specified is an arrival time.

departure

The time specified is a departure time.

lastAvailable

The time specified is the last available time. This time type is only returned for routes with a transit RouteMode that have the culture set to ja-jp.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>

      <script type="text/javascript">

         var map = null;
         var directionsManager = null;

         function GetMap()
         {
            // Initialize the map
            map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),{credentials:"Bing Maps Key"});
            Microsoft.Maps.loadModule('Microsoft.Maps.Directions', { callback: directionsModuleLoaded });

         }



         function directionsModuleLoaded()
         {
            // Initialize the DirectionsManager
            directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);

            // Create start and end waypoints and add them to the route
            var startWaypoint = new Microsoft.Maps.Directions.Waypoint({address:"Seattle, WA"});
            var endWaypoint = new Microsoft.Maps.Directions.Waypoint({address:"Bellevue, WA"});

            directionsManager.addWaypoint(startWaypoint);
            directionsManager.addWaypoint(endWaypoint);

            // Set arrival time to be 4 hours from now 
            var timeToDepart = new Date();
            timeToDepart.setTime(timeToDepart.getTime() + 14400000);

            // Set directions options
            directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.transit, transitOptions:{ transitTime: timeToDepart, timeType: Microsoft.Maps.Directions.TimeType.arrival } });
            directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('itineraryDiv') });

            // Specify a handler for when the directions are calculated
            Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', displayError);

            // Calculate directions, which displays a route on the map
            directionsManager.calculateDirections();


         } 


         function displayError(e)
         {
            alert(e.message);
         }


      </script>
   </head>
   <body onload="GetMap();">
      <div id='mapDiv' style="position:relative; width:400px; height:400px;"></div>       
      <div id='itineraryDiv' style="position:relative; width:400px;"></div>
   </body>
</html>
Show: