DirectionsRequestOptions Object

Note

Bing Maps Web Control SDK retirement

Bing Maps Web Control SDK is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Web Control SDK until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type. For detailed migration guidance, see Migrate from Bing Maps Web Control SDK and Migrate Bing Maps Enterprise applications to Azure Maps with GitHub Copilot.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

You can set options for how to calculate the route by passing an object containing direction request options to the setRequestOptions method of the DirectionsManager.

Properties

Name Type Description
distanceUnit DistanceUnit The unit to use when displaying direction distances. The default value is based on the specified culture.
maxRoutes number The number of routes to calculate. If the routeMode is;

  • Driving, up to 3 routes
  • Walking, only 1 route is supported
  • Transit, up to 6 routes

Default: 3
routeAvoidance RouteAvoidance[] The features to avoid when calculating the route. Default: none
routeDraggable boolean A boolean indicating whether the route line on the map can be dragged with the mouse cursor. Default: true

Truck based routes currently do not support being dragged.
routeIndex number If multiple routes are returned, the index of the route and directions to display.
routeMode RouteMode The type of directions to calculate. Default: driving
routeOptimization RouteOptimization The optimization setting for the route calculation. Default: shortestTime
time Date The time to use when calculating the route. If this property is set to null, the current time is used. This option only affects driving and transit routes.
timeType TimeTypes The type of the time specified. Default: departure

This option only affects transit routes, driving routes are always based on departure time.
vehicleSpec VehicleSpec Specifies the vehicle attributes to use when calculating a truck route.