Bing Maps API - Routing issue, tunnel height.

Dev 216 Reputation points
2021-06-30T12:25:24.827+00:00

I have a routing issue.

Using the following code:

                var map = new Microsoft.Maps.Map(document.getElementById('myMapTruckRoutes'), {
                    /* No need to set credentials if already passed in URL */
                    center: new Microsoft.Maps.Location(40.73095867476664, -74.04670184835668),
                    zoom: 16
                });
                Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
                    var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
                    directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('printoutPanel') });
                    directionsManager.setRequestOptions({
                        routeMode: Microsoft.Maps.Directions.RouteMode.truck,
                        vehicleSpec: {
                            dimensionUnit: 'ft',
                            vehicleHeight: 10
                        }
                    });
                    var wp1 = new Microsoft.Maps.Directions.Waypoint({
                    //address: "Washington Blvd.",
                        location: new Microsoft.Maps.Location(40.73095867476664, -74.04670184835668)
                    });

                    var wp2 = new Microsoft.Maps.Directions.Waypoint({
                    //address: "W Side Hway.",
                        location: new Microsoft.Maps.Location(40.7249546323,-74.0110042)
                    });

                    directionsManager.addWaypoint(wp1);
                    directionsManager.addWaypoint(wp2);
                    directionsManager.calculateDirections();
                });

I am expecting, due to the vehicle height that this will reroute via Holland Tunnel which has an allowed height of 12"6. However, the tunnel is avoided and a much longer route selected.

Any ideas why it would avoid Holland Tunnel?

If I set RouteMode to 'car' it routes as expected and uses Holland Tunnel.

Windows Maps
Windows Maps
A Microsoft app that provides voice navigation and turn-by-turn driving, transit, and walking directions.
245 questions
0 comments No comments
{count} votes

Accepted answer
  1. IoTGirl 2,976 Reputation points Microsoft Employee
    2021-06-30T22:46:28.907+00:00

    Hi Iain,

    I am not familiar with the Holland Tunnel specifically but are there other restrictions that might block a commercial vehicle from being allowed through that tunnel? Often it is a separate restriction, rather than just height that can cause a reroute.

    A quick search for https://www.bing.com/search?q=holland+tunnel+restrictions gives a third result that "Holland Tunnel The following restrictions are in place until further notice: In Both Directions: NO TRACTOR-TRAILERS, THREE-AXLE DUAL-UNIT TRUCKS, OR TRUCKS WITH FOUR OR MORE AXLES. Only two and three-axle single-unit trucks allowed. "

    You may need to provide a clearer definition of the vehicle as I believe truck routing will err on the side of caution if a value is not defined.

    Sincerely,
    IoTGirl

    0 comments No comments

0 additional answers

Sort by: Most helpful