Adding The two or more viaWaypoints(Start->Click Points->End Point) in the routing services

Answered Adding The two or more viaWaypoints(Start->Click Points->End Point) in the routing services

  • Tuesday, June 12, 2012 12:35 PM
     
     

    Hi,

    Can you plz  suggest me that how can i add two or more viaWaypoints in the routins services while creating a route.

    Thanx in advance

    prakash kumar

All Replies

  • Tuesday, June 12, 2012 1:28 PM
    Owner
     
     
    You haven't really given us much details here. An example of how to use the viaWaypoints can be found here: http://msdn.microsoft.com/en-us/library/hh441727.aspx

    http://rbrundritt.wordpress.com

  • Tuesday, June 12, 2012 1:56 PM
     
     

    Hi Richard,

    Scenario :->

                        1. I have Starting point & ending point.

                        2. By Each click Event(mouse click) I will get the points

     NOW          3. viaWayPoints are starting -> Point(clicked one) -> ending

                        4. draw route using routing services.

    Thanx in advance

    prakash kumar

  • Tuesday, June 12, 2012 3:07 PM
    Owner
     
     Answered
    You haven't specified which map API you are using. The approach you will want to take is to have an array that stores your waypoints. As the user clicks the map you will want to insert the new waypoint into the array as the second last point. This will ensure that your end point doesn't change.

    http://rbrundritt.wordpress.com

    • Marked As Answer by prakash_light Wednesday, June 13, 2012 4:40 AM
    •  
  • Wednesday, June 13, 2012 4:50 AM
     
     

    I m using silverlight->Bing map.

    can i use the  array for the user clicks & just an object for the starting point and Ending point.

    e.g.

              
                    RouteService.Waypoint srat= new RouteService.Waypoint();
                    start.Location = new RouteService.Location();
                    start.Location.Latitude = LocationOfWorkOrder.Latitude;
                    start.Location.Longitude = LocationOfWorkOrder.Longitude;


                    RouteService.Waypoint end= new RouteService.Waypoint();
                    end.Location = new RouteService.Location();
                    end.Location.Latitude = locFinal.Latitude;
                    end.Location.Longitude = locFinal.Longitude;

                      routeRequestForRoadPath.Waypoints.Add(start);
                        routeRequestForRoadPath.Waypoints.Add(end);

    and

         array for usr clicks.

    and lastly add the array and start and end object to the routerequest object.

    thanx Richard

  • Wednesday, June 13, 2012 9:09 AM
    Owner
     
     Answered
    It looks like you are using the Bing Maps SOAP service. viaWaypoints is only supported for the Bing Maps REST service. You can find information on how to use the REST services in .NET here: http://rbrundritt.wordpress.com/2012/01/06/bing-maps-rest-service-net-libraries/

    http://rbrundritt.wordpress.com

    • Marked As Answer by prakash_light Wednesday, June 13, 2012 11:26 AM
    •  
  • Wednesday, June 13, 2012 12:05 PM
     
     

    Thnx Richard for ur valuable help....

    i am getting the  route as i like it.but !!!!!!! thing is why it is not clearing the previous route...if m using the line code

    PROBLEM:

                       1.  myMapName.Children.Remove(RoadMapLayer);

                        RoadMapLayer.Children.Add(RoadMapPolyline);
                        myMapName.Children.Add(RoadMapLayer);

                       2.IT IS IN THE PICTURE

    Thnx Richard

  • Wednesday, June 13, 2012 3:46 PM
    Owner
     
     Answered
    Why not just clear the layer using RoadMapLayer.Children.Clear();

    http://rbrundritt.wordpress.com

    • Marked As Answer by prakash_light Thursday, June 14, 2012 5:03 AM
    •  
  • Thursday, June 14, 2012 5:05 AM
     
     

    Thnx Richard...i appreciate ur help....it works...f9..

    i have learned always a lot from ur experiance..thnx a lot