none
Truck route of Direction manager not working when drag route RRS feed

  • Question

  • Hi,

    As per the process if we plot the route and drag one location then by using (directionManager.getAllWaypoints()) will get the address, latitude and longitude in case of car.

    But if we followed the same steps by using'Truck' then it will only provide the latitude , longitude and address was null.

    I have tried the same process on Bing Map SDK as well refer this link (https://www.bing.com/api/maps/sdk/mapcontrol/isdk/directionscreatetruckroute#JS)and attached screenshot of the response.

    Also attaching the sample code which I have used.

    <u2:p>

    </u2:p>

    <u2:p><!DOCTYPE html></u2:p>

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <title></title>

        <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

        <script type='text/javascript'

                src='https://www.bing.com/api/maps/mapcontrol?callback=calculateTruckRoute&key=bing key''

                async defer></script>

        <script type='text/javascript'>

            var directionsManager;

            function calculateTruckRoute() {

                var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {

                    /* No need to set credentials if already passed in URL */

                    center: new Microsoft.Maps.Location(40.418386, -80.019262),

                    zoom: 16

                });

                Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {

                    directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);

                    directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('printoutPanel') });

                    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', function (e) { displayError(e); });

                    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', function (e) { directionsUpdated(e); });

                    directionsManager.setRequestOptions({

                        routeMode: Microsoft.Maps.Directions.RouteMode.truck,

                        vehicleSpec: {

                            dimensionUnit: 'ft',

                            weightUnit: 'lb',

                            vehicleHeight: 5,

                            vehicleWidth: 3.5,

                            vehicleLength: 30,

                            vehicleWeight: 30000,

                            vehicleAxles: 3,

                            vehicleTrailers: 2,

                            vehicleSemi: true,

                            vehicleMaxGradient: 10,

                            vehicleMinTurnRadius: 15,

                            vehicleAvoidCrossWind: true,

                            vehicleAvoidGroundingRisk: true,

                            vehicleHazardousMaterials: 'F',

                            vehicleHazardousPermits: 'F'

                        },

                        borderRestriction: {

                            type: "AvoidCrossing"

                        }

                    });

                    var wp1 = new Microsoft.Maps.Directions.Waypoint({

                        address: '590 Crane Ave, Pittsburgh, PA',

                        location: new Microsoft.Maps.Location(40.419228, -80.018138)

                    });

                    var wp2 = new Microsoft.Maps.Directions.Waypoint({

                        address: '600 Forbes Ave, Pittsburgh, PA',

                        location: new Microsoft.Maps.Location(40.437550, -79.993610)

                    });

                    directionsManager.addWaypoint(wp1);

                    directionsManager.addWaypoint(wp2);

                    directionsManager.calculateDirections();

                });

            }

            function displayError(event) {

                alert("HI")

            }

            function directionsUpdated(event) {

                alert("bye")

            }

        </script>

    </head>

    <body>

        <div id='printoutPanel'></div>

        <div id='myMap' style='width: 100vw; height: 100vh;'></div>

    </body>

    </html>


    Balasaheb

    Monday, February 3, 2020 6:57 AM

All replies

  • Hi Balasaheb, 

    Thanks for the inquiry. Bing Map routing engine can return routes with your specified waypoints and truck specs. We have forwarded the issue to Bing Maps SDK team to look into. Thanks!

    Monday, February 10, 2020 9:38 PM