none
Static map of Bus Route RRS feed

  • Question

  • I am just starting with a Universal app that gets the next bus for a certain state. The state has only one provider. I know the routes are supported by Bing as the provider is listed in the Routes API docs.

    Can someone point me in the right direction:

    I just need a static map that shows the route path. Any code sample would be very helpful.

    EDIT: Found this example of getting directions:

      public MainPage()
            {
                this.InitializeComponent();
    
                var directionsManager = MyMap.DirectionsManager;
    
                //Get the directions input panel and set the width and horizontal position
                var directionsInput = directionsManager.DirectionsInputView;
    
                directionsInput.Width = 340;
                directionsInput.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
                
                //Create a flyout and add the directions input panel to it.
                directionsInputFlyout = new SettingsFlyout()
                {
                    Background = new SolidColorBrush(Colors.DimGray),
                    Content = directionsInput,
                    Title = "Directions"
                };
    
                //Add the route summary to the instructions panel
                Instructions.Content = directionsManager.RouteSummaryView;
    
                //Attach an event to show the instructions panel when the route changes.
                directionsManager.ActiveRouteChanged += DirectionsManager_ActiveRouteChanged;
            }
    
            #endregion
    
            #region Event Handlers
    
            private void ShowDirectionsPanel_Tapped(object sender, TappedRoutedEventArgs e)
            {
                //Close bottom appbar
                this.BottomAppBar.IsOpen = false;
    
                //Show the directions input flyout
                directionsInputFlyout.ShowIndependent();
            }
    
            private void DirectionsManager_ActiveRouteChanged(object sender, DirectionsEventArgs e)
            {
                if (e.Route != null && e.Route.RouteLegs != null && e.Route.RouteLegs.Count > 0)
                {
                    //Set the instructions header info                
                    ToLocation.Text = string.Format("{0} Directions\r\n{1}",
                        e.Route.RouteMode,
                        e.Route.RouteLegs[e.Route.RouteLegs.Count - 1].EndLocation.Name);
    
                    //When the user presses the button to show the instructions panel.
                    DirectionsPanel.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }
                else
                {
                    //Hide the instructions panel
                    DirectionsPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                }
            }
    
            private void CloseDirections_Tapped(object sender, TappedRoutedEventArgs e)
            {
                //Hide the instructions panel
                DirectionsPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }

    I don't need directions - just need the map with the 2 points I add highlighted.

    Huh? This example is just a mystery. But it does what I need...after the "get directions" is somehow run.


    • Edited by cablehead Sunday, September 13, 2015 12:47 PM
    Saturday, September 12, 2015 1:41 PM

Answers

  • Bing Maps currently does not provide an overlay of transit routes. It only provides the ability to calculate  directions between two or more points. If you check the website of the transit company you may find they provide the data you are looking for which can then be overlaid on your application.

    http://rbrundritt.wordpress.com

    • Proposed as answer by Ricky_Brundritt Monday, September 14, 2015 3:30 PM
    • Marked as answer by cablehead Wednesday, September 16, 2015 12:31 AM
    Monday, September 14, 2015 3:30 PM