Travel time on a route

Topics: Windows Forms
Apr 5, 2012 at 1:11 PM

HI, first, SPECTACULAR JOB!!

I can not find how to get the travel time on a route. MapRoute class returns the distance but not time.

(GMapProviders.EmptyProvider.Projection.GetDistance(Points[i - 1], Points[i]))
 I have searched in the Demo, but I have not found anything.

(In other posts you comment in demo "route start tooltip cointains info about route lenght and travel time", I guess it will be an old demo?

Any information will help me. Thank you very much!!

Apr 5, 2012 at 1:37 PM

t = s / v, and google provider returns average time too

Apr 6, 2012 at 10:24 AM

 

trayecto = rp.GetRouteBetweenPoints(Puntos(i).pt, Puntos(i + 1).pt, False, False, MyMap.Zoom)

 

 RoutingProvider = GMapProviders.OpenStreetMap

trayecto.Name = "Driving"


 RoutingProvider = GMapProviders.GoogleMap

trayecto.Name = " (2,9 km / 8 minutos)"

Apr 6, 2012 at 4:56 PM

For RoutingProvider = GMapProviders.GoogleMap:

trayecto = rp.GetRouteBetweenPoints(Puntos(i).pt, Puntos(i + 1).pt, False, False, MyMap.Zoom)
txt = trayecto.Name.Substring(2, trayecto.Name.Length - 3).Split("/")
            If txt(0).Contains("km") Then
                distancia2 += CDec(txt(0).Split(" ").First)
            Else
                distancia2 += CDec("0," & txt(0).Split(" ").First)
            End If
            txt(1) = txt(1).TrimStart(" ")
            If txt(1).Contains("hor") And txt(1).Contains("minu") Then
                tiempo += New TimeSpan(txt(1).Split(" ").First, txt(1).Split(" ").ElementAt(2), 0)
            ElseIf txt(1).Contains("día") And txt(1).Contains("hor") Then
                tiempo += New TimeSpan(txt(1).Split(" ").First, txt(1).Split(" ").ElementAt(2), 0, 0)
            ElseIf txt(1).Contains("día") Then
                tiempo += New TimeSpan(txt(1).Split(" ").First)
            ElseIf txt(1).Contains("hor") Then
                tiempo += New TimeSpan(txt(1).Split(" ").First, 0, 0)
            ElseIf txt(1).Contains("minu") Then
                tiempo += New TimeSpan(0, txt(1).Split(" ").First, 0)
            ElseIf txt(1).Contains("segu") Then
                tiempo += New TimeSpan(0, 0, txt(1).Split(" ").First)
            End If

            tiempoTotal += New TimeSpan(tiempo.Days, tiempo.Hours, tiempo.Minutes, tiempo.Seconds)