Search code examples
javascripthtmlbing-apibing-maps

Disable Route Changing and hide waypoints in Bing Maps


Good day,

I am working with Bing Maps (purely html and javascript) for tracking a vehicle moving along a predefined route. I have created the routes using the DirectionsManager, however the user has the ability to drag the route to change it.

I would like to disable this function such that the user is not able to change the route as well as hide all the waypoints on the route.

Any assistance, guidance or resources to do this would be greatly appreciated. Thanks in advance.

Regards,


Solution

  • For the benefit of those who may stumble upon my question:

    Disable route dragging: set the directionsManager request option routeDraggable to false

    directionsManager.setRequestOptions({
                        routeMode: Microsoft.Maps.Directions.RouteMode.driving,
                        routeDraggable: false
    

    Hide waypoints and viapoints: Set directionsManager Render Options waypointPushpinOptions and viapointPushpinOptions visibility to false

    directionsManager.setRenderOptions({
                    itineraryContainer: document.getElementById('directionsItinerary'),
                    waypointPushpinOptions:{visible:false},
                    viapointPushpinOptions:{visible:false},
                });