Distance between 2 points on a bing map

Hi,

I am using a webbrowser control on a winform to host a bing map.
I need 2 things:

1) I want distance between 2 points.
2) I want a route between 2 points on the map.

How can i do this?

Thanks
shahjagatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ullfindsmitCommented:
Check out http://www.microsoft.com/maps/isdk/ajax/


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
      <script type="text/javascript">
         var map = null;
         
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap();
         
            var options = new VERouteOptions();
            options.RouteCallback = onGotRoute;
            map.GetDirections(["Microsoft", "Everett WA", "Bellingham WA"], 
                               options);
         }

         function onGotRoute(route)
         {
           // Unroll route
           var legs     = route.RouteLegs;
           var turns    = "Total distance: " + route.Distance.toFixed(1) + " mi\n";
           var numTurns = 0;
           var leg      = null;

           // Get intermediate legs
            for(var i = 0; i < legs.length; i++)
            {
               // Get this leg so we don't have to derefernce multiple times
               leg = legs[i];  // Leg is a VERouteLeg object
                  
               // Unroll each intermediate leg
               var turn = null;  // The itinerary leg
                  
               for(var j = 0; j < leg.Itinerary.Items.length; j ++)
               {
                  turn = leg.Itinerary.Items[j];  // turn is a VERouteItineraryItem object
                  numTurns++;
                  turns += numTurns + ".\t" + turn.Text + " (" + turn.Distance.toFixed(1) + " mi)\n";
               }
            }

            alert(turns);
         }
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
   </body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.