Travel Time in Traffic Same as Default

3 posts / 0 new
Last post
Travel Time in Traffic Same as Default

When I run my code below in excel VBA, the result is the same each time regardless of how I setup the "usetraffic" and other date/time parameters. I feel like this should vary depending on time of day, day of week, etc. I also tried "timetype = 3" and added date and time examples. All returned the same travel time.


Function GetDistance_MapQuest2(ByVal startFrom As String, ByVal endAt As String, ByRef refMiles As Double, ByRef refHours As Double)
    Dim url         As String
    Dim resp        As String
    Dim req         As Object       'MSXML2.XMLHTTP
    Dim xdoc        As Object       'MSXML2.DOMDocument
    Set req = CreateObject("MSXML2.XMLHTTP")
    Set xdoc = CreateObject("MSXML2.DOMDocument")
    url = ""
    url = url & "&from=" & Replace(Trim(startFrom), " ", "%20")
    url = url & "&to=" & Replace(Trim(endAt), " ", "%20")
    'Set req = New MSXML2.XMLHTTP
    req.Open "GET", url, False
    resp = req.responseText
    'Set xdoc = req.responseXML
    xdoc.LoadXML (resp)
    refMiles = CSng(xdoc.SelectSingleNode("response / route / distance").Text)
    refHours = CLng(xdoc.SelectSingleNode("response / route / time").Text) / 60 / 60
    Debug.Print "Miles: " & refMiles, "Hours: " & refHours
End Function

Sub FindMilesTest()
    Dim strStartFrom As String, strEndAt As String, refMiles As Double, refHours As Double
    strStartFrom = "2001 Silver Maple Ct. Naperville IL"
    strEndAt = "333 N Jefferson St. Chicago IL"
    GetDistance_MapQuest2 strStartFrom, strEndAt, refMiles, refHours
End Sub

Time vs realTime

I am noticing that realtime looks like only current traffic from both obersvation and the documentation. What is the purpose then of using the arrival or departure time parameters if only current or best guess traffic (and not historicals) is used? I am confused about the purpose of these parameters. They appear to be useful for predicting a travel time in the future (using past historical trends), but that does not seem to be the case. Thanks for any clarification you can provide.

time is calculated purely by
time is calculated purely by the path and speed limits along with penalties for maneuvers. realTime includes current traffic in the time calculation. I'm still getting details for the first question.