Creating aeroplane directions in Alteryx

by Lorna Eden

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.

Creating points

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.

Distance tool

 

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).

Final Formula

 

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.

Final Step

 

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

Plane direction 1

 

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

 

 

 

#DS2TipWeek - Publishing to Tableau Server using Command Prompt

2 mins read

Fri 19 Feb 2016

#DS2TipWeek - Arranging Shapes Using Index

3 mins read

Thu 18 Feb 2016

#DS2TipWeek - LODs of Fun with Custom Dates

2 mins read

Wed 17 Feb 2016

#DS2TipWeek - Fill a Date Range Using Alteryx

3 mins read

Tue 16 Feb 2016