Alteryx Routes Macro
The Routes macro can be used to create A to B routes that can be visualised on a map, as well as turn-by-turn directions.
If you haven't already installed the macro, you can download it from the Alteryx Gallery here .
To use the macro, drag it onto an Alteryx workflow from the TravelTime Platform tab in the top navigation.
Next we need to connect to some input data. This can be done either by connecting to a file using the Input Data tool, or by entering data manually using the Text Input tool.
The input data needs to contain the four fields as a minimum:
1. Origin Latitudes
2. Origin Longitudes
3. Destination Latitudes
4. Destination Longitudes
If your location data is in the form of addresses (e.g Postcodes) and not lat-long coordinates, then you can use our Geocoder macro to make this conversion first, before using the Routes macro.
In the example below we begin with one file of 1,000 employee addresses, and 5 office addresses. We'd like to investigate the routes for our 'high risk' employees, so we first apply a filter for this parameter, and convert the addresses into lat-long coordinates using the Geocoder macro. Finally these two datasets are combined using the Append Fields tool:
To configure the macro you first need to enter your API key details in the Credentials tab of the tool configuration.
If you don't yet have a TravelTime API key, you can get one for free here.
On the Configuration tab we select the fields in the input data that contain the Latitude and Longitude values for both the Origins and the Destinations, as well as whether we want to run an 'Arriving By' or 'Departing At' search.
The Output Type field determines the structure of the data returned by the tool:
- Summarized - returns one data row for each A to B route
- Detailed - returns multiple rows of data for each A to B route (one for each ‘leg’ of the journey)
On the next tab, Basic, we choose the method(s) of transport (ticking multiple allows different matrices to be created for different transport methods), and the date/time.
Selecting the Get Fare Data? tick-box will add public transport fare data to the macro output - this is only currently available in the UK.
For an 'Arriving By' search, this date/time is the arrival time. For a 'Departing At' search, this date/time is the departure time.
Finally, the parameters in the Advanced tab can be used to fine-tune the analysis if required.
These Advanced fields only apply to transport types that involve public transport. For a full explanation of what each field means, please see the documentation here.
The output of the Routes macro can be visualised through the Browse tool on a map:
We want to identify which employees travel through certain stations, and we can use the details of the routes to do this. We apply a filter on the Arrival Station field:
[Arrival Station] IN ("Oxford Circus Underground Station", "Victoria Underground Station", "Liverpool Street Underground Station", "London Bridge Underground Station", "Stratford Underground Station")
The result is a list of pairs of employees and offices which involve a journey through one of these stations:
If you are only interested in travel times and not visualising routes themselves, then the Alteryx Travel Time Matrix Macro macro may be an even better option.