Showing results for 
Search instead for 
Did you mean: 

Engine Works Blog

Under the hood of Alteryx: tips, tricks and how-tos.
Alteryx Certified Partner
Alteryx Certified Partner

This post originally appeared on The Geospatial Trinity.

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


picture1.pngLewisham 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 an 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's 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 my previous role that functionality wasn’t suitable, as I wanted to disperse the points in a controlled and dynamic manner.


picture2.pngOverview 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.


picture3.pngSpatial 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 multiply 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.


picture4.pngMulti-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 X1 and Y1 fields which use SIN and COS to move the CentroidX and CentroidY field around in a circle around from the original centroid.


picture5.pngFormula Tool Sohcahtoa

The final step in the workflow is to use the Create Points Tool. Use the 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.


picture6.pngSpatial Points Dispersed

Hope you find this solution helpful and hope this demonstrates how versatile Alteryx is.