none
SOAP Bing RouteService does not return RoutePath Points RRS feed

  • Question

  • Hi guys,

    I wrote a small sample app. Can anyone confirm the same results on this? I just want to know, if I do something wrong here or if the bug is on someone else' plate.

    			RouteServiceClient client = new RouteServiceClient();
    			
    			RouteRequest request = new RouteRequest();
    			request.Credentials = new Credentials();
    			request.Credentials.ApplicationId = "BingCredentials";
    			 
    			Waypoint start = new Waypoint();
    			start.Location = new Location();
    			start.Location.Latitude = 32.82;
    			start.Location.Longitude = -117.13;
    			 
    			Waypoint end = new Waypoint();
    			end.Location = new Location();
    			end.Location.Latitude = 33.93;
    			end.Location.Longitude = -118.40;
    			 
    			request.Waypoints = new List<Waypoint>();
    			request.Waypoints.Add(start);
    			request.Waypoints.Add(end);
    		
    			RouteResponse response = client.CalculateRoute(request);
    
    			Console.WriteLine(String.Format("{0} Legs received!", response.Result.Legs.Count));
    			Console.WriteLine(String.Format("{0} Itinerary Items received!", response.Result.Legs[0].Itinerary.Count));
    			Console.WriteLine(String.Format("{0} RoutePath Points received!", response.Result.RoutePath.Points.Count));
    
    			client.Close();
    
    			Console.ReadLine();
    

    The results for my Trip from San Diego to LA are:

     1 Legs received!
    12 Itinerary Items received!
    0 RoutePath Points received!

    • Moved by Ricky_Brundritt Friday, March 9, 2012 5:43 PM (From:Bing Maps: Map Control and Web services Development)
    Thursday, December 16, 2010 10:18 PM

Answers

  • You haven't requested to have the routepath included in the response. Add this:

    request.Options = new RouteOptions();
    request.Options.RoutePathType = RoutePathType.Points;
    

    Explained here:

    http://msdn.microsoft.com/en-us/library/cc966807.aspx

     

    (Note you may also need to increase the size of the maxreceivedmessagesize - the default is only 64kB and you won't get many points in that).


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    • Marked as answer by Rossi1972 Friday, December 17, 2010 4:43 AM
    Thursday, December 16, 2010 11:07 PM
    Moderator

All replies

  • You haven't requested to have the routepath included in the response. Add this:

    request.Options = new RouteOptions();
    request.Options.RoutePathType = RoutePathType.Points;
    

    Explained here:

    http://msdn.microsoft.com/en-us/library/cc966807.aspx

     

    (Note you may also need to increase the size of the maxreceivedmessagesize - the default is only 64kB and you won't get many points in that).


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    • Marked as answer by Rossi1972 Friday, December 17, 2010 4:43 AM
    Thursday, December 16, 2010 11:07 PM
    Moderator
  • Hi tanoshimi,

     

    Thanks a lot! That solved my problem. I guess it was a default setting before, right?

    Cheers,
    Steffen

    Friday, December 17, 2010 4:43 AM
  • thanks tanoshimi,

     

    this seems to be a recent requirement. I had a tool that retrieved RoutePath.Points just fine until a few weeks ago without requiring the

    request.Options = new RouteOptions();
    request.Options.RoutePathType = RoutePathType.Points;
    
    part. All is well again

    Monday, January 3, 2011 3:05 PM
  • I'm not sure if this was a recent change.... I wrote an article nearly two years ago (http://www.viawindowslive.com/Articles/VirtualEarth/CreatingRoutesinSQLServer2008usingVE.aspx) in which I said "...When the request for the route is made, it is important to set the route options to include the RoutePathType.Points property. This will ensure that the response includes all of the individual points that are used to construct the route....

    I don't think I would have bothered specifying the need to set the RouteTypePath to RouteTypePath.Points if it was the default anyway... but then again, I can't explain why your application stopped working a few weeks ago. At least you now know the solution!


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Monday, January 3, 2011 4:11 PM
    Moderator
  • Whether recent or not, I can see why they require it and why it is a good idea to only use it when necessary. One typical route I ran had 1316 points in it. That's a lot of wasted data if, for instance, you only needed the driving distance between two cities.
    Friday, May 27, 2011 4:16 PM
  • It never was set to True by default in order to reduce the size of the response.


    MVP - Bing Maps - My blog (FR): http://blogs.developpeur.org/nicoboo/ Twitter: http://twitter.com/nicolasboonaert/
    Friday, May 27, 2011 4:35 PM
    Moderator
  • I wrote up a bunch of MSDN articles on the SOAP services when they first came out and can confirm that the RoutePathType options has always been their since the initial release. Note that if you want a smaller response try using the REST services and return the data as JSON. The amount of data returned is much smaller. This is something worth noting for mobile applications.

    Windows Live Developer MVP - http://rbrundritt.wordpress.com | http://inknowledge.co.uk
    Friday, May 27, 2011 4:36 PM
  • In REST Route Web Service, you can avoid returning the RoutPath points (route geometry) by letting the default value.
    Or you can have this information by setting routePathOutput parameter.

    routePathOutput 
    rpo 
    Optional.  Specifies whether the response should include information about Point (latitude and longitude) values for the route’s path.
     
    One of the following values:
     Points: A list of Point values for the route’s path is provided in the response.

     None [default]: No information about the route’s path is provided in the response.


    Example: routePathOutput=Points


    MVP - Bing Maps - My blog (FR): http://blogs.developpeur.org/nicoboo/ Twitter: http://twitter.com/nicolasboonaert/
    Friday, May 27, 2011 9:24 PM
    Moderator