importXML for date/time routing?

6 posts / 0 new
Last post
brrrman
importXML for date/time routing?

(Pardon me in advance: eager newby alert...)

In Google sheets, I managed to pull drive time and drive distance between a set of locations perfectly fine using the following two simple commands:

=importXML("http://mapquestapi.com/directions/v2/route?key=MYKEY&outFormat=xml&from=" & A2 & "&to=" & B2,"//response/route/distance")

=importXML("http://mapquestapi.com/directions/v2/route?key=MYKEY&outFormat=xml&from=" & A2 & "&to=" & B2,"//response/route/formattedTime")

This completely works, and I'm just thrilled. Now, I tried to construct a third one to pull drive time with traffic stipulating arrival by 9AM local time on a typical Wednesday. So I did this, but it is returning "0.0". What am I doing wrong? 

=importXML("http://mapquestapi.com/directions/v2/route?key=MYKEY&outFormat=xml&from=" & A2 & "&to=" & B2 & "&dateType=4&timeType=3&localTime=09:00&useTraffic=true","//response/route/formattedTime")


MQBrianCoakley
The request above with two
The request above with two locations and my key works great for me. Can you post the exact request that is failing?   http://www.mapquestapi.com/directions/v2/route?key=KEY&outFormat=xml&fro...

brrrman
Weird: your request with my

Weird: your request with my key is not working for me either... Also, I am trying to do this for a bunch of non-US addresses (in this case: in Tel Aviv) - could that be the problem?


MQBrianCoakley
I plug your key into my
I plug your key into my request and I get an xml response with distance 14.792 and all the other stuff expected. What do you get back from that request?   Tel Aviv is definitely not our strongest area but it should work. Outside North America and Europe the 5-box input usually works better. Make sure the ISO two character country code is included.

Longtech2017
I need help to

I used the very top example as I only need a distance. It worked for like a few times and I was excited! but then I pasted the formula down into more cells of the spreadsheet and it stopped working.  Now I am seeing my transactions just skyrocket,and I dont' know how to get it back working. 


MQBrianCoakley
Can you post a request that
Can you post a request that is failing?   If all you need is distance then you may want to use the route matrix rather than a plain route. All it returns is time and distance.   Keep in mind that a route request with string addresses will count a geocode transaction for each location in that request in addition to the route transaction.