none
Direction manager question RRS feed

  • Question

  • Hi,

    We have used Bing V8 Direction manager to plot the route. It is working most of the time but when we tried to plot same address i.e point A and point B is same. For example when we tried to put From as New York and  To as New York. Then it did not happen anything we did not get any response or error in directionsError function. We got below error in console. 

    Is there way to get the error is DirectionError if same address is Enter and how to achieve this.

    Thanks!



    Balasaheb


    Thursday, February 1, 2018 12:39 PM

Answers

  • I'm not able to reproduce this error. Here is a sample I testing with on the Bing Maps ISDK:

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        /* No need to set credentials if already passed in URL */
        center: new Microsoft.Maps.Location(47.606209, -122.332071),
        zoom: 12 });
    Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
        var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
        // Set Route Mode to driving
        directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving });
        var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ address: 'seattle'});
        var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ address: 'Seattle'});
        directionsManager.addWaypoint(waypoint1);
        directionsManager.addWaypoint(waypoint2);
        // Set the element in which the itinerary will be rendered
        directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('printoutPanel') });
     Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', function () {
            document.getElementById('printoutPanel').innerHTML = 'Directions updated event fired!!!';
        });
    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', function (args) {
            alert(args.message);
        });
        directionsManager.calculateDirections();
    });
    
    Simply go to the following link, copy and paste this code into the code editor and press the run button: https://www.bing.com/mapspreview/sdkrelease/mapcontrol/isdk/directionscreatedrivingroute


    [Blog] [twitter] [LinkedIn]

    Tuesday, February 6, 2018 8:16 PM
  • I'm able to reproduce this now. I'll log a bug for the team to look into this. It looks like they ignore the second waypoint when it is the same as the first and simply don't do the calculation.

    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Wednesday, February 21, 2018 11:08 PM
    • Marked as answer by Ricky_Brundritt Wednesday, February 21, 2018 11:08 PM
    Friday, February 16, 2018 5:15 PM

All replies

  • Hi,

    Anyone have solution for this.

    Thanks!


    Balasaheb

    Tuesday, February 6, 2018 8:47 AM
  • I'm not able to reproduce this error. Here is a sample I testing with on the Bing Maps ISDK:

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        /* No need to set credentials if already passed in URL */
        center: new Microsoft.Maps.Location(47.606209, -122.332071),
        zoom: 12 });
    Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
        var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
        // Set Route Mode to driving
        directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving });
        var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ address: 'seattle'});
        var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ address: 'Seattle'});
        directionsManager.addWaypoint(waypoint1);
        directionsManager.addWaypoint(waypoint2);
        // Set the element in which the itinerary will be rendered
        directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('printoutPanel') });
     Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', function () {
            document.getElementById('printoutPanel').innerHTML = 'Directions updated event fired!!!';
        });
    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', function (args) {
            alert(args.message);
        });
        directionsManager.calculateDirections();
    });
    
    Simply go to the following link, copy and paste this code into the code editor and press the run button: https://www.bing.com/mapspreview/sdkrelease/mapcontrol/isdk/directionscreatedrivingroute


    [Blog] [twitter] [LinkedIn]

    Tuesday, February 6, 2018 8:16 PM
  • Hi Ricky,

    Thanks for your reply.

    Below is code where you can replicate the issue.

     var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
                    credentials: 'Bing map key',
                    center: new Microsoft.Maps.Location(47.606209, -122.332071),
                    zoom: 12
                });
                Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
                    var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
                    // Set Route Mode to driving
                    directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving });
                    var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ location: new Microsoft.Maps.Location(40.7145500183105, -74.0071411132813) });
                    var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ location: new Microsoft.Maps.Location(40.7145500183105, -74.0071411132813) });
                    directionsManager.addWaypoint(waypoint1);
                    directionsManager.addWaypoint(waypoint2);


                    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', function () {
                        alert("Call directionsUpdated");
                    });             

                    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', function (args) {
                        alert("Call directionsError");
                    });

                    directionsManager.calculateDirections();
                });

    Can you please check and let us know are we missing anything.

    Thanks!


    Balasaheb

    Thursday, February 8, 2018 9:48 AM
  • I've tried that code in a few browsers and it works fine, no errors.

    [Blog] [twitter] [LinkedIn]

    Thursday, February 8, 2018 4:38 PM
  • Hi Ricky,

    When we put different valid address then it come in directionsUpdated function. When we put inccorect address then it come in directionsError function. But in above case it did not came either directionsUpdated nor directionsError. It should came at least directionsUpdated or directionsError becasue based on this our next functionality works.

    Can you please let us know response for the same.

    Thanks! 



    Balasaheb

    Friday, February 9, 2018 5:19 AM
  • Hi,

    Any update on this issue.

    Thanks!


    Balasaheb

    Friday, February 16, 2018 2:36 PM
  • I'm able to reproduce this now. I'll log a bug for the team to look into this. It looks like they ignore the second waypoint when it is the same as the first and simply don't do the calculation.

    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Wednesday, February 21, 2018 11:08 PM
    • Marked as answer by Ricky_Brundritt Wednesday, February 21, 2018 11:08 PM
    Friday, February 16, 2018 5:15 PM
  • Hi Ricky,

    Hope you are doing well.

    Any update on above issue. Now this issue is priority for us.

    Thanks!


    Balasaheb

    Friday, April 6, 2018 6:59 AM
  • Try the experimental branch. The team was working on this before I moved (I'm not longer on the Bing Maps team). 

    [Blog] [twitter] [LinkedIn]

    Friday, April 6, 2018 7:31 PM
  • Hi,

    We have tried using experimental branch but facing same issue.

    Can you please inform Bing maps team. 

    Thanks! 



    Balasaheb

    Saturday, April 7, 2018 8:54 AM
  • Hi,

    Any update on this issue.

    Thanks!


    Balasaheb

    Wednesday, April 11, 2018 10:04 AM
  • We have reached out to our Development Team for an update.   We will update this thread as soon as we have more information.

    If you are a Bing Maps Enterprise Customer you can reach out to our team directly at https://www.microsoft.com/en-us/maps/support and we can provide you updates through E-mail. 

    Wednesday, April 11, 2018 2:58 PM
    Moderator