Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By wildpeaks

How to draw the route path in bing map version 7.0 by passing the lat and long as a source and address as a destination

This is a discussion on How to draw the route path in bing map version 7.0 by passing the lat and long as a source and address as a destination within the Bing Maps and MapPoint Web Service forums, part of the Map Forums category; I am facing the problem to draw the route path when i am passing the lat and long as a ...

  1. #1
    vipulsinghal2006 is offline Junior Member White Belt
    Join Date
    Apr 2011
    Posts
    7

    How to draw the route path in bing map version 7.0 by passing the lat and long as a source and address as a destination

    I am facing the problem to draw the route path when i am passing the lat and long as a source and address as a destination like in bing map version 6.3.

    And also if i pass the address as a destination and if same address belongs to multiple location then enable to display the popup of multiple location or disambiguation like the inbuilt feature in bing map version 6.3.

    Can anyone provide the solution for the above problems. ASAP

  2. #2
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,069
    Blog Entries
    4

    Re: How to draw the route path in bing map version 7.0 by passing the lat and long as a source and address as a destination

    Did you see this page?

    Getting Route Directions Using the REST Services

    Also, here's some source code from the interactive API on working with a route:

    HTML Code:
    <!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&#91;j&#93;;  // 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>
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  3. #3
    vipulsinghal2006 is offline Junior Member White Belt
    Join Date
    Apr 2011
    Posts
    7

    Re: How to draw the route path in bing map version 7.0 by passing the lat and long as a source and address as a destination

    Actually i want to draw a route in ajax bing map version 7.0 by using the source of the route as a lat and long and destincation as a address but i am enable to get the route by passing this.

    And if i pass the address as a destincation and passing address is belongs to multiple location then in ajax bing map version 7.0 enable to show the disambiguation dialog box as like its inbuild functionality in ajax bing map version 6.3.

    Please provide me any detail solution for this with example

  4. #4
    wildpeaks is offline Junior Member White Belt
    Join Date
    May 2011
    Posts
    3

    Re: How to draw the route path in bing map version 7.0 by passing the lat and long as a source and address as a destination

    The route function is no longuer available in v7 (nor is the disembiguation dialog).

    However the good news is that you can use the REST services to do the same thing v6.3 was doing internally anyway (and you can use the same credentials as the AJAX control's).

    You would use the Location service for the disembiguation first, and the Routes service for calculating the route once you have the geocoded coordinate.

    Also, the Routes service (as far as I recall) can handle one step as latlong and destination as address if needed / want to skip disembiguation.

    REST Services API: Bing Maps REST Services

    (and once you have the route, you would use its legs to create Polyline entities and add them to map.entities (or create an EntityCollection added to the map).

  5. #5
    VALT is offline Junior Member White Belt
    Join Date
    Mar 2012
    Posts
    1

    Re: How to draw the route path in bing map version 7.0 by passing the lat and long as a source and address as a destination

    Hello, I tried this as a cut and paste and no map appeared- what am I missing. Also, is it possible for you to include a form (see below) for user input of destination 2 (or destination 1 and 2?) in the example - this is something I hope to get working in the next few days! I need the complete code because I am still a cut and paste person :-0




    name="form" action="" method="post">

    id="from" type="text" value="" name="From" />

    id="findit" type="button" value="Find It!" name="find" onclick="GetDirections();"/>

    />

    />

    Your directions are:
    />

    id="directions" cols="50" rows="20" value="">



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 07-26-2010, 02:00 PM
  2. Delete Numerator from waypoints when i draw a route
    By Genamo in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-23-2006, 03:18 AM
  3. How I can Disable the summary of map when I Draw a Route
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-09-2005, 08:04 AM
  4. Draw a route between two LONGS LATS
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 02-16-2005, 09:08 AM
  5. How can i find address by passing Lat/Lon as parameter?
    By joesebi in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-09-2003, 09:10 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81