none
BingMaps: Problem with "CalculateRoute" RRS feed

  • Question

  • Hallo,

    I write you because of a problem with "calculateRoute" in BingMaps.

    my application brings allways the error : "One or more waypoints can't be routed because they are too far from any roads."

    Even with the waypoints from the MSDN-example ist does not work ?  :-(
    Here is my code:

    Dim RouteRequest As net.virtualearth.dev.RouteRequest = New net.virtualearth.dev.RouteRequest
    
    
    
      ' Set the credentials using a valid Bing Maps key
    
      RouteRequest.Credentials = New net.virtualearth.dev.Credentials()
    
      RouteRequest.Credentials.ApplicationId = bingkey
    
    
    
      ' Einstellen der Von- und Bis-Koordinaten (Start- und Zielpunkt).
    
      Dim Waypoints As net.virtualearth.dev.Waypoint() = New net.virtualearth.dev.Waypoint(1) {}
    
      Waypoints(0) = New net.virtualearth.dev.Waypoint()
    
      Waypoints(0).Location = New net.virtualearth.dev.Location()
    
      Waypoints(0).Location.Longitude = -79.23
    
      Waypoints(0).Location.Latitude = 43.89
    
      Waypoints(1) = New net.virtualearth.dev.Waypoint()
    
      Waypoints(1).Location = New net.virtualearth.dev.Location()
    
      Waypoints(1).Location.Longitude = -79.03
    
      Waypoints(1).Location.Latitude = 43.89
    
    
    
      RouteRequest.Waypoints = Waypoints
    
    
    
      ' Durchführen der Routen-Anfrage.
    
      Dim RouteService As net.virtualearth.dev.RouteService = New net.virtualearth.dev.RouteService
    
      Dim RouteResponse As net.virtualearth.dev.RouteResponse = RouteService.CalculateRoute(RouteRequest)
    
    


    I hope, that somebody cam hepl me :-)

    THX, Wilifred.

     

     

    • Moved by Ricky_Brundritt Saturday, March 10, 2012 11:53 AM (From:Bing Maps: Map Control and Web services Development)
    Monday, August 9, 2010 8:44 AM

Answers

  • Try setting the LatitudeSpecified and LongitudeSpecified property of each waypoint to TRUE. e.g.

    Waypoints(0).Location.LongitudeSpecified = true<br/>
    Waypoints(0).Location.LatitudeSpecified = true<br/>
    Waypoints(1).Location.LongitudeSpecified = true<br/>
    Waypoints(1).Location.LatitudeSpecified = true
    


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Monday, August 9, 2010 8:57 AM
    Moderator

All replies

  • Try setting the LatitudeSpecified and LongitudeSpecified property of each waypoint to TRUE. e.g.

    Waypoints(0).Location.LongitudeSpecified = true<br/>
    Waypoints(0).Location.LatitudeSpecified = true<br/>
    Waypoints(1).Location.LongitudeSpecified = true<br/>
    Waypoints(1).Location.LatitudeSpecified = true
    


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Monday, August 9, 2010 8:57 AM
    Moderator
  •  

    Hi, that was a good idea.
    It works very well.

    THANKs !!!

    • Marked as answer by wilfried42x Monday, August 9, 2010 9:27 AM
    • Unmarked as answer by Ricky_Brundritt Monday, August 9, 2010 2:49 PM
    Monday, August 9, 2010 9:26 AM
  • Is there a solution to the problem? I can't see and LatitudeSpecified / LongitudeSpecified properties.
    chandrasekhar, student partner
    Tuesday, November 8, 2011 11:15 AM