none
Cannot get a map with more than 5 waypoints RRS feed

  • Question

  • Starting yesterday, previously working map requests with more than 5 waypoints (no via's) return an error "The waypoint you entered cannot be found.  Response Code: 17"  Can't find any answers when searching for this online.  Has something changed recently -- or has something gone wrong with my code?

    The requests are created in Access, with never more than 20 addresses.  My Bing developer's key is active -- we are a non-profit, so there are no billing issues.

    A copy of a working request with just 5 addresses is below, along with a non-working request with 9 addresses.

    //***THIS ONE WORKS***

    <!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" /> <script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap' async defer></script> <script type='text/javascript'> var map; var directionsManager; function GetMap() { map = new Microsoft.Maps.Map('#myMap', { credentials: 'MYBINGKEY (my actual key is used here)' }); //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. var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ address: '73468 Highway 111 Palm Desert CA'}); directionsManager.addWaypoint(waypoint1); var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ address: '67625 E Palm Cyn Dr Cathedral City CA'}); directionsManager.addWaypoint(waypoint2); var waypoint3 = new Microsoft.Maps.Directions.Waypoint({ address: '7552 Regency Dr Palm Springs CA'}); directionsManager.addWaypoint(waypoint3); var waypoint4 = new Microsoft.Maps.Directions.Waypoint({ address: '34139 Judy Lane Cathedral City CA'}); directionsManager.addWaypoint(waypoint4); var waypoint5 = new Microsoft.Maps.Directions.Waypoint({ address: '2351 Birdie Way Palm Springs CA'}); directionsManager.addWaypoint(waypoint5);

    //Add event handlers to directions manager. Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', directionsError); Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', directionsUpdated); //Calculate directions. directionsManager.calculateDirections(); }); } function directionsUpdated(e) { //Get the current route index. var routeIdx = directionsManager.getRequestOptions().routeIndex; //Get the distance of the route, rounded to 2 decimal places. var distance = Math.round(e.routeSummary[routeIdx].distance * 100)/100; //Get the distance units used to calculate the route. var units = directionsManager.getRequestOptions().distanceUnit; var distanceUnits = ''; if (units == Microsoft.Maps.Directions.DistanceUnit.km) { distanceUnits = 'km' } else { //Must be in miles distanceUnits = 'miles' } //Time is in seconds, convert to minutes and round off. var time = Math.round(e.routeSummary[routeIdx].timeWithTraffic / 60); document.getElementById('routeInfoPanel').innerHTML = 'Distance: ' + distance + ' ' + distanceUnits; } function directionsError(e) { alert('Error: ' + e.message + '\r\nResponse Code: ' + e.responseCode) } </script> </head> <body> <div id="myMap" style=";width:1000px;height:750px;"></div> <div id='routeInfoPanel'></div> </body> </html>


    //***THIS ONE DOES NOT WORK!??***
    
    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
        <meta charset="utf-8" />
        <script type='text/javascript'
                src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap'
                async defer></script>
        <script type='text/javascript'>
            var map;
            var directionsManager;
            function GetMap()
            {
                map = new Microsoft.Maps.Map('#myMap', {
                     credentials: 'MYBINGKEY (my actual key is used here)'
                });
                //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.
                     var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ address: '73468 Highway 111 Palm Desert CA'});
                     directionsManager.addWaypoint(waypoint1);
                     var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ address: '67625 E Palm Cyn Dr Cathedral City CA'});
                     directionsManager.addWaypoint(waypoint2);
                     var waypoint3 = new Microsoft.Maps.Directions.Waypoint({ address: '7552 Regency Dr Palm Springs CA'});
                     directionsManager.addWaypoint(waypoint3);
                     var waypoint4 = new Microsoft.Maps.Directions.Waypoint({ address: '34139 Judy Lane Cathedral City CA'});
                     directionsManager.addWaypoint(waypoint4);
                     var waypoint5 = new Microsoft.Maps.Directions.Waypoint({ address: '2351 Birdie Way Palm Springs CA'});
                     directionsManager.addWaypoint(waypoint5);
                     var waypoint6 = new Microsoft.Maps.Directions.Waypoint({ address: '2605 South Linden Way Palm Springs CA'});
                     directionsManager.addWaypoint(waypoint6);
                     var waypoint7 = new Microsoft.Maps.Directions.Waypoint({ address: '1150 E Palm Canyon Dr Palm Springs CA'});
                     directionsManager.addWaypoint(waypoint7);
                     var waypoint8 = new Microsoft.Maps.Directions.Waypoint({ address: '221 East Laverne Way Palm Springs CA'});
                     directionsManager.addWaypoint(waypoint8);
                     var waypoint9 = new Microsoft.Maps.Directions.Waypoint({ address: '462 North Palm Cyn Dr Palm Springs CA'});
                     directionsManager.addWaypoint(waypoint9);
                        //Add event handlers to directions manager.
                    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', directionsError);
                    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', directionsUpdated);
                    //Calculate directions.
                    directionsManager.calculateDirections();
                });
            }
            function directionsUpdated(e) {
                //Get the current route index.
                var routeIdx = directionsManager.getRequestOptions().routeIndex;
                //Get the distance of the route, rounded to 2 decimal places.
                var distance = Math.round(e.routeSummary[routeIdx].distance * 100)/100;
                //Get the distance units used to calculate the route.
                var units = directionsManager.getRequestOptions().distanceUnit;
                var distanceUnits = '';
                if (units == Microsoft.Maps.Directions.DistanceUnit.km) {
                    distanceUnits = 'km'
                } else {
                    //Must be in miles
                    distanceUnits = 'miles'
                }
                //Time is in seconds, convert to minutes and round off.
                var time = Math.round(e.routeSummary[routeIdx].timeWithTraffic / 60);
                document.getElementById('routeInfoPanel').innerHTML = 'Distance: ' + distance + ' ' + distanceUnits;
            }
            function directionsError(e) {
                alert('Error: ' + e.message + '\r\nResponse Code: ' + e.responseCode)
            }
        </script>
    </head>
    <body>
        <div id="myMap" style=";width:1000px;height:750px;"></div>
        <div id='routeInfoPanel'></div>
    </body>
    </html>

    Any help would be GREATLY appreciated!



    • Edited by AVDandy Thursday, March 8, 2018 8:31 PM
    Thursday, March 8, 2018 8:19 PM

Answers

  • I suspect the issue is that the each of the addresses being passed in are being geocoded before the route calculation is being done, and they are being geocoded right away. As such, this is exceeding the 5 query per second limit for basic accounts (unlicensed). The QPS limits are mentioned in the terms of use but were only recently enforced. I'll pass this on to the team to see if they can make some adjustments to better handle this.

    [Blog] [twitter] [LinkedIn]

    Friday, March 9, 2018 2:39 PM