Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Google Maps Driving Distance and Duration API with Alteryx

marlop
6 - Meteoroid

Hi All,

 

I've been trying to get actual driving distances and duration by wrapping in my personal API key.

 

I've been following this amazing guide: https://jdunkerley.co.uk/2016/07/21/geocoding-and-finding-nearest-station-with-google-web-services/

 

This is exactly what I need but I keep getting errors when inputting the API key URL in the Formula tool.

 

Also, do I need to use the Distance tool (since I only have the general license it doesn't come with TomTom capabilities) at any point or can I just add the results onto the data I already have? (I used the Append Tool to get multiple addresses listed)?

 

Thanks!

19 REPLIES 19
jdunkerley79
ACE Emeritus
ACE Emeritus

Glad you liked the post.

 

Have stuck together a quick workflow loading a route into the Google drive time and distance API. should be a reasonable starting point for you.

 

James

marlop
6 - Meteoroid

Hi James,

 

I'm not quite sure what I'm doing wrong but I've attached what I just did (with some of your help on a different issue!).

I think I need to add another join in order for the original results to query Google services in just the way I want it.

 

What do you think?

jdunkerley79
ACE Emeritus
ACE Emeritus

could you drop some sample data so I can try running it through?

 

I put together a guess of what you are trying to do based on what you posted.

 

You will need to enter an API key in the Text Input in the Yellow container

marlop
6 - Meteoroid

Sorry James!

 

Sample data should be attached.

marlop
6 - Meteoroid

James,

 

When replacing your data with mine I get the accurate results I want. You're amazing :)

 

Thank you so much for your help! (My thesis will go a bit better now!)

 

Martha

jdunkerley79
ACE Emeritus
ACE Emeritus

Always happy to help 

kraboin
5 - Atom

Nearly a year later this really helped me - thank you! 

robshiffer
7 - Meteor

Hi, I've tried running this and it works great so far in short bursts!

 

However, I'm running into the issue where I have 10 origin points and thousands of destination points and when I simply list all points as equal, I get multiple millions of records trying to go through the API. Is there a way to specifically set which points are origin points and which ones are destination points to be able to scale the workflow?

TravisR
Alteryx Alumni (Retired)

Hi @robshiffer - I use the Google API a bit and this is how I do it.

 

I keep the Origin and Destination lat/lons as separate fields in my data stream and then I make a callout to the Google Distance Matrix API like this:

 

https://maps.googleapis.com/maps/api/distancematrix/json?origins=[Origin Lat/Lon]&destinations=[Destination Lat/Lon]&units=[Unit Type]&key=[key]

Labels