community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Google Maps Driving Distance and Duration API with Alteryx

Highlighted
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!

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

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?

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

Meteoroid

Sorry James!

 

Sample data should be attached.

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

Always happy to help 

Atom

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

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?

Alteryx
Alteryx

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