## Creating aeroplane directions in Alteryx

by Lorna Brown

So after Paul Chapman set me a challenge to make sure my aeroplanes were facing the direction of travel, I made it my job to figure out how to do this. He had already sent my a file with 360 plane images rotating through the 360 degree range.

In my dataset I had latitude and longitude of each airport, along with the routes taken. The first thing was to create points in Alteryx for a single point for each airport. I did this for both origin and destination airports.

Once I did this, I remembered that the ‘Distance’ tool in Alteryx gave cardinal directions (NW, SE etc). So I knew this must be the next tool to use. So again I used two Distance tools, one for origin to destination and then another from destination to origin. I realised I needed two of these after I tried to do numerous different equations and then it finally twigged that I hadn’t created the direction of the route back. Below is the tool and how I configured the first one. Centroid is from the first points tool and centroid 2 is from the second points tool. I figured I didn’t want distance all I cared about was the direction in degrees. So I un-ticked everything else except that last tick box. The second distance tool uses centroid 2 first then centroid.

Once I ran this workflow and put it into Tableau, I figured there was one last calculation I needed. I created it in Tableau first to see if it worked, and then pushed it back into Alteryx, as this is best practice. If I didn’t create this formula I wouldn’t be able to have different direction of planes for origin and destination airports. This formula basically will tell Tableau to draw a different shape for each origin and destination based on the Type (Origin or Destination).

Finally the next step was to assign the different planes to the different degrees. I split by origin and destination, did the average of Degree (The calculation above), then dragged this to shape and airport name route onto detail to get all the different degree’s. The reason I did an average is because my data is duplicated due to having a hub and spoke map. If you do use this just check your data before you choose your level of aggregation. I imported the folder Paul sent me to get the full range of planes.

I then used this in my map to show the direction of travel from origin and destination, as seen in the image below.

Now I have 360 different aeroplanes based on the direction in degrees of their route.

Let me know if you try this and if you like it. I personally think it is really cool, and can’t wait to use this handy tip again.

Thanks

Lorna Brown

Fri 19 Feb 2016

Tue 16 Feb 2016