Dispersing Spatial Points with Alteryx

How do you deal with spatial data that is geocoded to one address/location?

Lewisham Shopping Centre 10 retail units geocoded to the address

The simple answer is you need to disperse your points and some mapping software providers do provide that option. In my previous role I needed to disperse points and we had a commercial Geographic Information Systems (GIS) software, that had a disperse function which was additional option that wasn’t selected. However can you come up with a solution if you have Alteryx?

I was inspired to a potential solution by John Tullis talk about his Alteryx Analogue Clock at an Alteryx user group. Where he used trigonometry to create the hands of the clocks. I thought I could use the same logic to move the points around in a circle from the original geocoded location utilising Sohcahtoa.

It’s worth noting that Alteryx provides a Random Point function that “Returns a random point within the spatial object”. In this particular case in my previous role that functionality wasn’t suitable, as I wanted to disperse the points in a controlled and dynamic manner.

Overview of Alteryx workflow

The workflow is quite simple use a summarise tool to count the total records, append that total to the data stream. Then use the Spatial Info tool to get centroid as X and Y fields in British national grid. Two reasons for this is the location is within the United Kingdom and also the projection system returns X and Y as Eastings and Northings and are whole integers.

Spatial Info British National Grid

The formula tool divides 360 degrees by the total e.g. Location with 4 points = (360/4=90) Point 1=90 Point 2=180, Point 3=270 Point4=360. This is important for later in the Alteryx workflow when we multiple the angle by radians. The next step is to create a cumulative angle field and initially set the value to 0. Use a Multi-Row formula tool to add the angle cumulatively per each row of data to add up to 360 degrees.

Multi-Row Formula Cumulative Angle

The last formula tool is where I calculate where the points need to be moved. First I create a Radians field divide PI by 180 degrees multiplied by the Cumulative Angle field.  Then create an X1 and Y1 fields which uses SIN and COS to move the CentroidX and CentroidY field around in a circle around from the original centroid.

Formula Tool Sohcahtoa

The final step in the workflow is to use the Create Points Tool use X1 and Y1 fields as Longitude and Latitude. With fields projected floating points as British National Grid. This will use the new X and Y fields to create the points and the output should show the points are dispersed in a circle.

Spatial Points Dispersed

Hope you find this solution helpful and hope this demonstrates how versatile Alteryx is. Please leave a comment below or reach out to me on Twitter @JosephSerpis

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s