Hello. How can we help you?

Travel Time Matrix macro

A guide to using the Travel Time Matrix macro from TravelTime

The Travel Time matrix macro can be used to create Origin-Destination journey time matrices, as well as distance matrices and public transport fare matrices.

 

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 Travel Time Matrix macro.

 

In the example below we begin with one file of 500 origin postcodes, and 5 destination postcodes. These are then converted into lat-long coordinates using the Geocoder macro, before being combined into a single file using the Append Fields tool:

Input-data

To configure the macro you first need to enter your API key details in the Credentials tab of the tool configuration.

api-key

If you haven't yet signed up for an API key, you can get a free key for testing 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.

config1

 

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.

 

config2

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.

config3

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 Travel Time Matrix macro contains a Metric field and a Value field.

Each row of the output data contains one Origin, one Destination, and one Metric. Possible values of the Metric field are:

  • distance
  • travel_time
  • Fare single (GBP)
  • Fare week (GBP)
  • Fare month (GBP)
  • Fare year (GBP)

To create the desired matrix, we add a Filter tool to isolate the Metric we are interested in, followed by a Cross Tab tool.

For any records that cause an error, details of the error can be found in the Failure output anchor, including the Error Code and links to more information.

 

In the example below we apply two filters:

"Query Transport Method" = Driving

"Metric" = travel_time

 

We then add a Cross Tab tool with the following configuration:

Crosstab

The resulting output is a matrix of travel times with our 500 employee postcodes in the rows and the 5 office postcodes as the column headings:

Output

To create a matrix of distances or public transport fares, simply change the value in the Metric filter