none
Need to calculate distance between one point to multiple points RRS feed

  • Question

  • Hi

    I have requirement to calculate distance between one location to multiple locations at one time. Is it can be achieved using route web rest API? I have tried one point to another. i am able to get travel distance. But i need to get the distance values from one point to other multiple points at one request.

    Please help me.

    Thanks,

    Vanaja


    • Edited by Vanaja M Wednesday, August 6, 2014 11:53 AM
    Wednesday, August 6, 2014 11:52 AM

Answers

  • This has been answered many times on the forums. The routing REST service allows you to pass in multiple waypoints (up to 25 in a single request). If you pass in [A, B, C, D] as the waypoints this will generate a route from A to B to C to D. What you can do is loop back to your starting point and pass in the waypoints like [A, B, A, C, A, D] and this will generate a route from A to B to A to C to A to D. The route response will return an array of route legs for each waypoint pair. The first, third and fifth route leg will be the routes from A to B, A to C, and A to D. You can then grab the distances from those route legs.

    Here is a blog post that uses this logic: http://blogs.bing.com/maps/2011/03/18/dev-tip-of-the-week-how-to-search-by-driving-time-with-ajax-v7-rest-and-spatial-data-services/


    http://rbrundritt.wordpress.com


    • Proposed as answer by Ricky_Brundritt Wednesday, August 6, 2014 12:26 PM
    • Edited by Ricky_Brundritt Wednesday, August 6, 2014 12:29 PM
    • Marked as answer by Vanaja M Thursday, August 7, 2014 10:44 AM
    Wednesday, August 6, 2014 12:26 PM

All replies