Using the MapQuest APIs to Build Route Optimisation: Finding the Fastest Route to Dinner

This article was written by Vsoni and originally appeared on the Alteryx Data Analytics blog here:


In a world reliant on online shopping, deliveries, and take-away dinners, understanding the fastest way to get from point A to point B has never been more important.

With the Alteryx drive-time data packages, users can perform drive-time optimisation to understand the fastest / shortest routes with ease.

However, in regions where these datasets are not available, it may be a challenge to figure out the fastest route you should use, and when it comes to picking up pizza on a Friday night, there is a need for speed.


In this example, we will use the MapQuest API to perform this analysis.

Using a starting point of Taco Bell (a fan favourite), we use the ‘Create Points’ tool from the Alteryx Spatial tools to transform latitude and longitude data into a spatial object, which we can visualise using the ‘Browse’ tool.

We also use this to provide a latitude and longitude for where we, the hungry customer, are located.



The MapQuest API then allows us to choose if we want the shortest or the fastest and provides turn by turn information on the route we should take.

We can simply pass the URL of the API endpoint we need to query, which is what we’ll use the ‘Download’ tool to do. The output from this gives us the API response that we can then parse out.

We can then use the ‘Parsing’ tools in Alteryx to take the relevant data points out the API response data, as well as the Alteryx Spatial tools to build a turn-by-turn route as to what we should take to get to our dinner.

Further, we can take the APIs time data to calculate how long it will take to complete our journey, as well as the length in miles, kilometres, or both.

Once this has been done, we can turn this workflow into a macro, allowing us to specify any start / end point, and Alteryx will use the MapQuest API to figure out the fastest or shortest route to get from point A (aka us) to point B (aka Dinner).



From here, anyone with Alteryx can utilise the MapQuest API (once they have their own key of course, which can be found here, allowing them to determine the best way to get to / from any destination!

Although we have mainly been using this for food, typically we have seen customers from all verticals utilizing drive time optimisation.

From supply chain and logistics, to catering and ensuring ATMs have enough bank notes for withdrawals, understanding which route to take and when can have huge revenue potential. With Alteryx, it's never been easier.

Our users use geospatial data for all sorts of different usecases; from using heatmaps to understand where revenues are coming from, new store location optimisation and planning, and even solving the age-old Travelling Salesman problem.

If you’re new to spatial data, try out some of the in-built tutorials, or some of the weekly challenges to give it a go.