This is a migrated thread and some comments may be shown as answers.

More than 20 (25) waypoints.

3 Answers 98 Views
Map
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 2
Victor asked on 06 Jun 2017, 04:48 PM

Hi there,

 

I have read that it should be possible to add 'Viawaypoints' in combination in normal 'Waypoints'.

I however cannot find a c# method other than  'reqRoute.Waypoints.Add(l_sWaypoint);'

What is the right manner to have more than 25 waypoints in my route?

 

Kind regards,

Victor

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Jun 2017, 11:41 AM
Hello Victor, 

Thank you for writing.  

Currently, RadMap doesn't support ViaWaypoints. However, it is a reasonable request. I have logged it in our feedback portal and I have added a vote for it on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to create a custom BingRestMapProvider and override its BuildRoutingRequestUri method where you can add the ViaWaypoints. Here is demonstrated a sample approach:

public class CustomBingRestMapProvider : BingRestMapProvider
{
    protected override Uri BuildRoutingRequestUri(RouteRequest request)
    {
        List<string> waypoints = new List<string>();
 
        foreach (string str in request.Waypoints)
        {
            waypoints.Add(str.ToString());
        }
 
        request.Waypoints.Clear();
 
        Uri result = base.BuildRoutingRequestUri(request);
 
        StringBuilder path = new StringBuilder();
 
        for (int i = 0; i < waypoints.Count; i++)
        {
            if (waypoints[i].StartsWith("#VIA#"))
            {
                path.Append("&vwp." + i + "=" + Uri.EscapeDataString(waypoints[i].Substring(5)));
            }
            else
            {
                path.Append("&wp." + i + "=" + Uri.EscapeDataString(waypoints[i]));
            }
        }
 
        string uri = result.AbsoluteUri;
        uri = uri.Insert(uri.IndexOf('?') + 1, path.ToString() + "&");
 
        return new Uri(uri);
    }
}
 
public void RunRouteRequest()
{
    //add a layer to display the route
    this.radMap1.MapElement.Layers.Add(new MapLayer());
    RouteRequest request = new RouteRequest();
    request.DistanceUnit = DistanceUnit.Kilometer;
    request.Options.Mode = TravelMode.Driving;
    request.Options.Optimization = RouteOptimization.Time;
    request.Options.RouteAttributes = RouteAttributes.RoutePath;
    request.Options.RouteAvoidance = RouteAvoidance.None;
    
    request.Waypoints.Add("Paris, France");
    request.Waypoints.Add("#VIA#Madrid, Spain");
    request.Waypoints.Add("Vienne, Austria");
    BingRestMapProvider bingProvider = this.radMap1.Providers[0] as BingRestMapProvider;
    bingProvider.CalculateRouteCompleted += BingProvider_RoutingCompleted;
    bingProvider.CalculateRouteAsync(request);
}

I hope this information helps. Should you have further questions I would be glad to help.

 Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Victor
Top achievements
Rank 2
answered on 16 Sep 2019, 08:58 PM

Hi,

Is there any news on this topic?

Kind regards

Victor

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Sep 2019, 12:27 PM
Hello, Victor, 

As the status of the feedback item states, the item has already been completed. The feature was introduced in R2 2018 SP1 (version 2018.2.621). Here is the release history for your reference: https://www.telerik.com/support/whats-new/winforms/release-history/ui-for-winforms-r2-2018-sp1-(version-2018-2-619)

The RouteRequest now offers the RoutePoints property where each element represents a stop in the route. The elements could be Waypoint or ViaWaypoint.
 
I hope this information helps. If you need any further assistance please don't hesitate to contact me.

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Map
Asked by
Victor
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Victor
Top achievements
Rank 2
Share this question
or