Spatial Analysis in Alteryx Part 1: The Basics - Points, Lines, and Polygons

by Simon Evans

There are some nifty tools and features to play around with spatial data in Alteryx. But what is spatial data?

In basic terms spatial data is information about shapes and locations of geographical features and the relationships between them.

Spatial data can be made up of

1.       Points (A singular point on a map)

2.       Lines (Made from multiple points)

3.       Polygons (A combination of points and lines. A polygon could be a country, city, county or state for example).

The map input tool is an easy way to manually create points, lines, or polygons as shown below:

The map input tool in Alteryx is located within the In/Out category of tools
The map input tool used to create a point at the centre of Buckingham Palace
The map input tool used to create a line from one side of Hyde Park to the other
The map input tool used to create a polygon around Hyde Park

Points can also be generated from data fields containing latitude and longitudes using the Create Points tool:

The Create Points tool is located within the Spatial category of tools

In this example, the latitude and longitude of reported fires in London from a single month have been configured within the tool:

If we then add a browse tool after our Create Points tool and run this we can see the following points are created on our map:

The location of reported fires in London

Note that within our results window now we have an additional field named Centroid with all our created points:

Our newly created Centroid field

It is always good practice to insert a select tool at this point and re-name this field to something more meaningful, especially if you are going to be creating more spatial fields within the same workflow:

The centroid field re-named to Incident Location using the Select tool

The Poly-Build tool is one which can be used to make lines, and polygons. In the below example, London bus routes have been mapped out using the Create Points, and Poly-Build tool to join the points by making lines.

This data set examines the route of London buses

Firstly our create points tool can be used as previously to create our points of each stop from our Longitude and Latitude. Again as good practice I have re-name the newly created Centroid field to Stop Location.

We can then use the Poly-Build tool to create our bus route lines.

The Poly-Build tool is located in the Spatial category of tools

The created points in this case is our source field (Stop Location). We want to group these by bus route, so for example the number 1 route will contain each and every stop that the number 1 bus stops at, and include no stops from any other numbered buses. Lastly we need a sequence field, which tells Alteryx the order in which to draw the line. Note from earlier that our data is in a long format, with the sequence field having 1 row per stop. If your data is wide, you may have to transform your data using the transpose tool to get the sequence field reading top to bottom.

If we then add a browse and there you have it! All of London's bus routes mapped. The full workflow and map can be seen below:

Polygons that have already been formed can also be brought into Alteryx as shape files or .yxdb files.

A good website for obtaining UK constituencies and region borders as already formed polygons, or the latitude and longitude of the points making these up can be found at:

Open Geography Portal (statistics.gov.uk)

I myself have used this site to obtain a UK constituency shape file in a previous Data School project, the blog post associated with it can be found here

The Data School - How to create a macro to parse UK Petition Data in Alteryx

I hope you found this beginners guide useful to getting started with Spatial Data in Alteryx, in the next part of this 2 part blog I will go into more of the Spatial tools and walkthrough some examples answering real life questions from our data!