Bing Maps REST API - No route was found for the waypoints provided

Anthony Sgro 1 Reputation point
2021-06-14T17:50:49.287+00:00

I have created an app that works perfectly with driving and walking for the Bing Routes API between two latitudes and longitudes. Here is the structure:

http://dev.virtualearth.net/REST/V1/driving?wp.0=${employee.latitude},${employee.longitude}&wp.1=${client.latitude},${client.longitude}&dateTime=12:00:00&distanceUnit=mi&output=json&key=${process.env.BING_MAPS_KEY}`,

Whenever I replace driving with walking, it works. But whenever I replace driving with "transit", it doesnt! This is supposed to be used for NYC, so I don't know what to do. I am only limiting my request to two waypoints like the documentation says.

Let me know if there is something specific I have to do for the transit search to work. Thank you.

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

1 answer

Sort by: Most helpful
  1. IoTGirl 2,976 Reputation points Microsoft Employee
    2021-06-14T18:56:36.667+00:00

    Hi Anthony,

    You need to do like the web site does. Try the steps at Bing.com/maps and you will see what I mean. Basically not all points are "Routeable" and transit legs can go beyond the leg limits of the routing REST API.

    Repro Steps:

    1. Go to Bing.com/maps and enter your starting point in the UI -> You will see this immediately convert to the closest routable address
    2. Choose "Directions" and then enter the second coordinate -> You will see this do the same transformation
    3. Find the route -> This will work because the non-routable points have been converted to the closest routable points

    The number one question I get is why doesn't the API do this for me and the best answer is, we don't want to mislead and say a point is accessible for routing of a certain type if it isn't so to accomplish the same thing with the REST API:

    1. Call https://learn.microsoft.com/en-us/bingmaps/rest-services/locations/find-a-location-by-point and use the Geopoint with "<UsageType>Route</UsageType> " for the start and end points
    2. Call the REST Route API with the "Route" co-ordinates

    NOTE: Bing Maps TOU (https://www.microsoft.com/en-us/maps/product) does allow for the caching of geocodes while you are licensed so if you do have a license, you can store the routable geocodes for addresses you use frequently.

    Sincerely,
    IoTGirl

    1 person found this answer helpful.
    0 comments No comments