The inspiration for this series of blog posts came from a recent client project where I had to convert latitude and longitude (GPS coordinates) into a customised coordinate system. The new coordinates had to reflect distances relative to an origin point. In this blog post, I hope to describe briefly how I converted latitude and longitude into coordinates on the required grid using Alteryx. A subsequent blog post will address the challenges of a dynamic origin point and frame of reference.


Create Points and Choose Origin

To start, let’s assume the following data structure:


Sample Input File


I then use the Create Points tool to create point-type spatial objects by specifying the Latitude and Longitude input fields. This is important since some of Alteryx’s spatial tools work with spatial objects rather than the individual latitude and longitude. If you want to know more about Projected Floating Points, click here or the Help icon next to the Configuration menu on the Create Points tool.


Next, an Origin Point must be selected. In this case, I have selected the first point in the data to be my origin point. In other words, my subsequent distance calculations will be relative to this origin point. This origin point needs to be appended to each row in the data set.


Choose Origin Point and Append to other points



Use Distance Tool Outputs to Calculate XY Distances from Origin

I now use the Distance Tool to calculate the distance between a particular point to the chosen origin. In this workflow, I need the direction of the point from origin, which can be set as an output from the Distance Tool. The output direction defaults to degrees from North (similar to that on a compass)



With this information, we can convert the distance and direction output to X and Y “coordinates” using some Trigonometry:

X Distance away from Origin

COS( (90-[Direction from North])/180*PI() ) * [DistanceMeters]

Y Distance away from Origin

SIN( (90-[Direction from North])/180*PI() ) * [DistanceMeters]

where the “Direction from North” is the direction output and “DirectionMeters” is the distance output from the Distance Tool


I have include the resultant workflow below:


Convert Distance and Direction to XY distance from Origin


In my next blog post, I discuss what happens if different origin points are needed in different parts of the data set. This also will influence how the X and Y coordinates have to be calculated. Stay tuned for it here.



Alex Chan
Author: Alex Chan