none
How can i display a bing map using Longitude & latitude? RRS feed

  • Question

  • Hi all,

    I am displaying the route legs in list control. I am storing Longitude and latitude route leg(start and end) in List(collection). On click of the row in the List control i want to display the map for that leg. I am having the  Longitude and latitude of the leg, now i want to display leg map. Say the route has 6 legs.

    1) How can i show map of leg 1 or 6 legs ?

    2) Once i get map leg 2 then want to navigate each leg .

     

    I am able to display the complete route map for a given Start to destination location.

    any link to sample would be great.

     

    thanks.

    I am using BIng map.

    • Moved by Ricky_Brundritt Saturday, March 10, 2012 11:13 AM (From:Bing Maps: Map Control and Web services Development)
    Monday, October 3, 2011 5:33 PM

Answers

  • Hi Prasad,

    So are you wanting to animate the drawing of each leg? As in have the line start at a point and extend to the next point? or are you just wanting each leg to be displayed sequentially?

    You should probably be able to use a storyboard to animate drawing the legs and you could also move the centre of the view to follow the drawing of the lines.

    Please let me know if i can be of further assistance.

     

    Regards,

    Duncan

    Wednesday, October 5, 2011 7:43 PM

All replies

  • Good Morning,

    If you are using the Bing Maps Silverlight control then you may generate a LocationRect object by using the constructor that takes a list of the coordinates that you want to fit into the view.

    You may then use the SetView method of the map control and pass in the LocationRect and this will move the view so it shows the pocations you provided centered and at the greatest zoom possible for the location you are in.

    Example:

    ' Your collection of locations 
    ' (could use LocationCollection)
    
    Dim legs As new List(Of Location)
    
    ' At some point you populate this list
    
    
    ' Then you could use a bit of LINQ to Objects to 
    ' choose which locations to include
    
    ' this will skip the first two locations and take 
    ' location 3 and 4
    
    Dim selectLocations as IList(of Location) = 
                    legs.Skip(2).Take(2)
    
    
    ' Then setup your LocationRect
    
    Dim locRect AS New LocationRect(selectLocations)
    
    ' then set the map view
    
    myMap.SetView(locRect)
    
    
    
    


    I hope this will help

     

    Duncan

     

    Monday, October 3, 2011 8:22 PM
  • Hello Duncan,

    Thanks for your reply.

    I am using the Bing Maps Silverlight control with C#. Ya i can you the myMap.SetView(locRect),  but it will not show/draw the route on the map.

    How can i use information of longitude/latitude to draw route?

    Thanks,

    Prasad.

    Wednesday, October 5, 2011 1:19 PM
  • Hi Prasad,

    So are you wanting to animate the drawing of each leg? As in have the line start at a point and extend to the next point? or are you just wanting each leg to be displayed sequentially?

    You should probably be able to use a storyboard to animate drawing the legs and you could also move the centre of the view to follow the drawing of the lines.

    Please let me know if i can be of further assistance.

     

    Regards,

    Duncan

    Wednesday, October 5, 2011 7:43 PM
  • Hi Duncan,

    Thanks for your reply.

    I want to show map of Leg1 to Leg2 with line between the legs, indicating the start leg and end leg.

    Then i have buttons like previous/next. On clicking them, i should show the previous/next map.

    Say there are 6 legs for route for location A to location B, which i have shown in listcontrol. When user click 3rd row in list,  it will show map for (leg 3- leg 4 ) route with line for it.

    On Click_previous() show map for (leg 2- leg 3 ) route with line for it

    On Click_next() show map for (leg 4- leg 5 ) route with line for it and so on...

    i am having information as mentioned at start of the query.  Please let me know if more information is needed.

    any sample code for this would be of great help.

     

    Regards,

    Prasad.


    • Edited by PrasadDash Friday, October 7, 2011 10:48 AM
    Friday, October 7, 2011 10:47 AM