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

Draw route directly with list of coordinates not list of waypoints

4 Answers 143 Views
Map
This is a migrated thread and some comments may be shown as answers.
Cyril
Top achievements
Rank 1
Cyril asked on 15 May 2018, 09:32 AM

Hello,

Do you know if it's possible to draw route directly from coordinates (precalculated with address, town stored in database) ?

I can just use WayPoint from routerequest object, but it's a argument type string ?

In BingMapsRESTToolkit project, it's possible to set coordinates directly to calculate a route ?

But I don't found options with RadMap ?

Do you know if it's possible to add this option with a legacy (inherit) or not ?

Dim oRequest As New RouteRequest()
            With oRequest
                .DistanceUnit = DistanceUnit.Kilometer
                With .Options
                    .Mode = TravelMode.Driving
                    .Optimization = RouteOptimization.Time
                    .RouteAttributes = RouteAttributes.All
                    .RouteAvoidance = RouteAvoidance.Highways
                End With
                With .Waypoints
      STRING NOT  POINTG
                End With
            End With

Thank you

Best regards

4 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 15 May 2018, 11:04 AM
Hi Cyril,

Thank you for writing.

You can still accomplish this with the WayPoints collection of the RouteRequest. Just please make sure that the coordinates are passed as a string in the correct format so that the proper URI can be built. Please also check my code snippet below: 
private void radButton1_Click(object sender, EventArgs e)
{
    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("47.6062, -122.3321"); //Seattle
    request.Waypoints.Add("25.789, -80.2264"); //Miami
 
    bingProvider.CalculateRouteAsync(request);
}

I hope this helps. Let me know if you need further assistance.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Cyril
Top achievements
Rank 1
answered on 15 May 2018, 07:59 PM

Hello

For this code, it's OK but all asynchronous requests on Bing server give like results a bad kilometers and a bad duration !!!!

After test with RestSharp Project via Execute and ExecuteAsync same results => bad kilometers (lot of kilometers)  and bad duration (very long duration)

BAD RESULT WITH ASYNCHRONOUS REQUETS !!! Thank you Micro$oft !!!

With simple synchronous request with Webclient API, all results is good !!! IT'S A BUG THAT ISN'T NEED FIXED

Best regards

0
Cyril
Top achievements
Rank 1
answered on 16 May 2018, 08:04 AM

Sorry, It's my fault

I just reverse latitude and longitude in my code !!

Really sorry

 

0
Hristo
Telerik team
answered on 16 May 2018, 09:59 AM
Hi Cyril,

I am glad that you have managed to resolve the issue. Please let me know if you need further assistance.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Map
Asked by
Cyril
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Cyril
Top achievements
Rank 1
Share this question
or