A guide to using the Geocoder macro from TravelTime
The Geocoder macro can be used for two purposes:
- Standard geocoding - converts a street address (e.g a postcode) into a lat-long coordinate
- Reverse geocoding - converts a lat-long-coordinate into a readable street address
If you haven't already installed the macro, you can download it from the Alteryx Gallery here
To run either type of geocoding, drag the macro onto an Alteryx workflow from the TravelTime Platform tab in the top navigation.
Next we need to input the data to be geocoded. 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.
In the example below we are connecting to a file of 500 postcodes in London:
To configure the macro you first need to enter your API key details in the Credentials tab of the tool configuration.
If you haven't yet signed up for an API key, you can get a free key for testing here.
Next we select whether we want to run a Standard or Reverse geocode, and which fields from the input data correspond to the address (for Standard) or the Lat-Long coordinates (for Reverse).
Here we select Standard, and the address field as Postcode:
The final configuration required is in the Basic tab:
Enabling the Specify Focus Country parameter will mean that the Geocoder will only return coordinates or address within a specific country. As all of the postcodes in our input data are in London, we select the UK from the dropdown.
As with all parameters in the TravelTime macros, the country can also be selected based on a field in the input data. This is particularly useful when geocoding data in multiple countries at once.
The Top N Matches parameter can be used to return multiple matches per input record if they exist. For example, when running the Reverse Geocoder, there may be more than one street address with the same Lat-Long coordinates, such as with multiple flats in the same building. by default this is set as 1, so the Geocoder will only return the best match for each input record.
Ticking the Include Feature Information? box will return additional information regarding what data TravelTime has available for that location, including whether it is an area for which we have public transport and fare data.
Adding a Browse tool to both output anchors, the workflow below can now be run:
The output from the Success anchor can be viewed in two ways. The first of which is a visual plot of all successfully geocoded points on a map:
The second way to view the output data is in the table format:
The table displays the Score for each record (between 0 and 1, illustrating the strength of the match, 1 being the best).
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.