I am getting inexplicable Maps.Events directionsErrors: We can't find directions between one or more waypoints.

RJBreneman 201 Reputation points
2024-03-08T20:55:38.3433333+00:00

I am using Bing Maps REST API via java script. My routing application is working well for virtually all customers in all scenarios. I have one customer getting errors like this in only some scenarios:

We can't find directions between one or more waypoints. Check your waypoints and route options and try again.

I have a copy of their locations and can replicate the issue at will. I will describe the scenario in general concepts to show what is confusing.

I map a set of 20 locations and it works well. Starting with those 20 locations in each point below:

  • Remove one of a certain subset of the locations - no error.
  • Remove one of the disjoint subset of the locations - error.
  • Remove any two or more of any of the locations - no error.
  • Add one or more new locations to the set of 20 - no error.

The non-error subset and the error subset are constant and predictable. The removal of a single, given location always produces the same behavior. Randomly reordering the locations before mapping makes no difference in any of these scenarios.

Update Mar 14, 2024: Adding a code snippet, a sample data point, and a screenshot.

//Sample data point element:
{lat:26.098341500000000,lon:-80.365857200000000,nm:'FALK \u0026 FALK, P.A.',ad:'1655 N Commerce Pkwy',ct:'Weston',st:'FL',zp:'33326-3276',co:'US'}
//Code snippet:
function addWaypointsDM() {
    try {
        var idx, loc, waypoint;
        for (idx = 0; idx < gcodes.length; idx++) {
            loc = new Microsoft.Maps.Location(gcodes[idx].lat, gcodes[idx].lon);
            if (gcodes[idx].ad.length > 0) {
                waypoint = new Microsoft.Maps.Directions.Waypoint({ location: loc, 
                    address: gcodes[idx].nm + ' - ' + gcodes[idx].ad
                });
            } else {
                waypoint = new Microsoft.Maps.Directions.Waypoint({ location: loc,
                    address: gcodes[idx].nm + ' - ' + loc.toString()
                });
            }
            directionsManager.addWaypoint(waypoint);
        }
    }
    catch (err) {
        showError('showStops:addWaypointsDM', err.message);
    }
}

Capture

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

1 answer

Sort by: Most helpful
  1. IoTGirl 3,051 Reputation points Microsoft Employee
    2024-03-12T19:17:09.2066667+00:00

    If these are valid locations, you can report them using "Feedback" on Bing.com/maps but based on your example, "Falk&Falk" is not an address and would not be supported by the Bing Maps Locations API. As noted, re-ordering will not "fix" a bad location. Only correction or removal of the bad waypoint will fix the issue. To avoid collecting bad addresses we often recommend geocoding right when the customer provides the address that way it can be corrected right away and not stored as an invalid text value.