Directions with Options

When calculating directions request options can be used to modify how the route is calculated. Render options can be used to customize how the route is displayed on the map. In this example driving directions are calculated in kilometers and set to avoid highways. The route line is rendered green and thick, while the title of all waypoints are replaced with an empty string to hide the default behaviour.

<!DOCTYPE html>
    <meta charset="utf-8" />
    <script type='text/javascript'>
    var map, directionsManager;

    function GetMap()
        map = new Microsoft.Maps.Map('#myMap', {
            credentials: 'Your Bing Maps Key'

        //Load the directions module.
        Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
            //Create an instance of the directions manager.
            directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);

            //Create waypoints to route between.
            directionsManager.addWaypoint(new Microsoft.Maps.Directions.Waypoint({ address: 'London, UK' }));
            directionsManager.addWaypoint(new Microsoft.Maps.Directions.Waypoint({ address: 'Paris, FR' }));
            directionsManager.addWaypoint(new Microsoft.Maps.Directions.Waypoint({ address: 'Madrid, ES' }));

            //Set the request options that avoid highways and uses kilometers.
                routeAvoidance: [Microsoft.Maps.Directions.RouteAvoidance.avoidLimitedAccessHighway]

            //Make the route line thick and green. Replace the title of waypoints with an empty string to hide the default text that appears.
                drivingPolylineOptions: {
                    strokeColor: 'green',
                    strokeThickness: 6
                waypointPushpinOptions: {
                    title: ''

            //Calculate directions.
    <script type='text/javascript' src='' async defer></script>
    <div id="myMap" style="position:relative;width:800px;height:600px;"></div>

Running this code will display a map with a route from London, UK to Madrid, Spain, going through Paris, France which looks like this.

Screenshot of a Bing map showing a route from London, UK to Madrid, Spain with a stop in Paris, France.

Try it now

See also this sample on Fully Custom Waypoint Pushpins