none
Calculate the distances of multiple destination from a single starting point

    Question

  • Hi Experts,

    I want to calculate the distance of multiple destination from a single point. How can i calculate this.

    For Example : 

    I have location(latitude and longitude) points of hosipitals in a city and i want to find out the distance of each hospital from my home in a single web service request. let suppose i have 20 hospital locations and want to find the distance of each hospital from my home.

    Thanks in Advance

    Wednesday, July 03, 2013 5:43 AM

Answers

  • Hi

    There is currently no built in "distance matrix" functionality in the API but you can achieve the same thing in one call.

    All you do is create ask for routing information and add each point as a waypoint. So the route is A->B->A-C->A->D ... There is a limit of 25 way points so you can do this for 12 points in one call. This method gives you the real distance as well, not as the crow flies so even better.

    Then you can walk through the route you get back and get the distances for each seperate leg you want.

    Its a little bit of code work but not too difficault


    Brian @ Earthware - UK interactive mapping web developers http://www.earthware.co.uk/blog | http://www.twitter.com/earthware | Windows Live Developer MVP

    Wednesday, July 03, 2013 10:31 AM
  • We have a code sample that shows how to do this for Windows Store apps here: http://code.msdn.microsoft.com/Bing-Maps-trip-optimizer-c4e037f7

    http://rbrundritt.wordpress.com

    Wednesday, July 03, 2013 1:34 PM

All replies

  • Hi

    There is currently no built in "distance matrix" functionality in the API but you can achieve the same thing in one call.

    All you do is create ask for routing information and add each point as a waypoint. So the route is A->B->A-C->A->D ... There is a limit of 25 way points so you can do this for 12 points in one call. This method gives you the real distance as well, not as the crow flies so even better.

    Then you can walk through the route you get back and get the distances for each seperate leg you want.

    Its a little bit of code work but not too difficault


    Brian @ Earthware - UK interactive mapping web developers http://www.earthware.co.uk/blog | http://www.twitter.com/earthware | Windows Live Developer MVP

    Wednesday, July 03, 2013 10:31 AM
  • We have a code sample that shows how to do this for Windows Store apps here: http://code.msdn.microsoft.com/Bing-Maps-trip-optimizer-c4e037f7

    http://rbrundritt.wordpress.com

    Wednesday, July 03, 2013 1:34 PM