none
How to render Bing maps route directions without optimization? RRS feed

  • Question

  • Question: how to get route in the order of waypoints added to the directionsManager?

    Scenario: We are trying to migrate the mapping components from Google-maps to Bing-maps. There is a functionality to turn-on and turn-off the route optimization for provided waypoints.

    In Google request object there is a boolean property (optimizeWaypoints) to set optimization, but I couldn't find this optimization option in Bing direction request object options.

    Please correct me if I'm missing something here and it would be really helpful if someone share their workaround experience in this context.

    Here is the Google-doc link:

    https://developers.google.com/maps/documentation/javascript/directions#DirectionsRequests

    • optimizeWaypoints (optional) specifies that the route using the supplied waypoints may be optimized by rearranging the waypoints in a more efficient order. If true, the Directions service will return the reordered waypoints in a waypoint_order field.(For more information, see Using Waypoints in Routes below.)

    Following is the Bing documentation link and code reference

    https://docs.microsoft.com/en-us/bingmaps/v8-web-control/modules/directions-module/directionsrequestoptions-object

    directionsManager.setRequestOptions({ /* shortestTime is default value as per the docs*/
    routeOptimization: Microsoft.Maps.Directions.RouteOptimization.shortestTime });
    Name Type Description
    routeOptimization RouteOptimization The optimization setting for the route calculation. Default: shortestTime

    Thanks,
    Koti.

    • Edited by Koti Panga Thursday, May 2, 2019 3:01 AM
    Thursday, May 2, 2019 2:36 AM

All replies

  • Hi Koti,

    Please take a look at https://docs.microsoft.com/en-us/previous-versions/mt829678(v=msdn.10)

    The waypoints order optimization parameter is described as:

    Parameter

    Alias

    Description

    Values

    optimizeWaypoints

    optWp

    Optional. Instructs the API to rearrange the route waypoints and reduce the route cost specified with the optimize parameter. The route first waypoint wp.0 and last waypoint wp.n order is not changed, their position is considered fixed.

    A Boolean value.

     

    Notes:

    • The parameter is available only for Driving travel modes.
    • The parameter is available only when the route waypoints number is greater than 2, the route is composed of more than just the start and end waypoints.

     

     

    Thursday, May 9, 2019 11:56 PM
    Owner