Advanced Map Visualisation in Tableau using Alteryx

Posted by on Jan 23, 2014

At The Information Lab we like a challenge and so, when we saw this visualisation last week, we wanted to try something similar as a Tableau visualisation, using arrows to show the migration flows. Certainly this would be hard enough, but we also wanted to make it accessible; so no tough mathematics, no complex table calculations and no coding at all. Could it be done? Well to test him out we gave the problem to one of our newest recruits Chris Love to see what he’d make of it.

Let’s start with final dashboard to let you judge the result for yourself and then we’ll let Chris guide you through how he built it and how you can build similar visualisations quickly and easily.

If you looked at the second dashboard then I hear you shouting “You cheated! You used a separate application to generate the data”. Well sorry folks, but that’s how us new guys make a name for ourselves – by building things even the most advanced users would find difficult. So yes, to generate the data I used Alteryx – a data manipulation tool that specialises in data manipulation and geospatial analysis (as well as predictive analytics) – but I assure you all it required was some straightforward data manipulation and a little bit of an imagination for problem solving – as promised there were no complex calculations and no hard maths.

Let’s start by looking at the problem of generating the arrows themselves, how can we solve this? My Alteryx experience told me that all I needed was a set of points for each arrow and then I could use the Alteryx Build Polygon Tool to generate the shapes as polygons (Adam Riley at Alteryx recently independently used this technique to draw gauges in Alteryx reports). If you remember doing dot-to-dots as a child then this will be familiar to you, all we need to do is generate the dots, in order, and Alteryx will help us to do the rest. I put my thinking cap on and came up with the following “maths-free” approach.

StepByStep

Makes sense right? There are so many other ways of solving this problem but I like the simplicity of this solution, and Alteryx allows me the luxury of solving the problem in the way I want; in fact that’s one of the reasons that makes Alteryx appealing for such a wide range of problems – it allows you to concentrate on solving the problem your way, and take away any coding challenges. So what tools does Alteryx provide to help me implement my solution? Let me introduce some of them and talk about how they are traditionally used, and how I’m using them:

Create Point Create Point Typical usage: Create spatial points in the data stream using numeric coordinate fields.How I’m using it: I’m converting the States central latitude and longitude into spatial points.

Trade AreaTrade Area

Typical usage: Define radii (including non-overlapping) or drive-time polygons around specified points.How I’m using it: To create the circles in Steps 1 and 3

Poly SplitPoly Split

Typical usage: Split a polygon or polyline into its component polygons, lines, or points.How I’m using it: Breaking the circle into a series of points in Steps 2 and 3.

JoinJoin

Typical usage: Combine two data streams based on common fields (or record position). In the joined output, each row will contain the data from both inputs.How I’m using it: Joining the split points from the circle to the main point to pass into the distance tool.

DistanceDistance

Typical usage: Calculate the distance or drivetime between a point and another point, line, or polygon.How I’m using it: The distance tool allows returns the bearing of objects, so I can use it to find the points on the circle in step 2

FormulaFormula

Typical usage: Create or update fields using one or more expressions to perform a broad variety of calculations and/or operations.How I’m using it: To create some custom fields to help me with some quick calculations on the way, e.g. ensuring no negative angles.

Poly BuildPoly Build

Typical usage: Create a polygon or polyline from sets of points.How I’m using it: To build the final arrow polygon from the series of ordered points

I’m using some other tools too, such as Sort and Sample to collect the point nearest to the one I need, but those above are the main tools.

Alteryx also allows me to then encapsulate this logic into a single “macro” to reuse in other modules, and we can expose simple parameters to allow us to control the functionality of the underlying tools dynamically. I’ve done this in order to embed the logic in a larger module to transform the migration data into Tableau. You can download the full packaged module here and take a look at how it works in Alteryx (download a trial if you haven’t already).

I’ve also created a public “app” in the Alteryx Gallery using my Arrow Generation module. Apps are simple to set up via Alteryx and can be instantly published to the Gallery via one button click. The result? Anyone can now generate their own arrows for tableau, in tde format, using a free, public application. Visit the app* here and register for the gallery to try it out, no software install necessary, and watch the three minute video below to see how easy this is for any to produce stunning visualisations in Tableau using this app – and make sure you let us know what you think.

 

*Please note the app is not necessarily production ready, and hasn’t been tested thoroughly to catch all errors – it is intended as a demonstration of what is possible.

Chris Love

Tableau & Alteryx Consultant
Alteryx Grand Prix Champion 2013 & 2014

Latest posts by Chris Love (see all)

5 Comments

  1. Nice technique. You might have your arrows backwards. More people migrated from California to Texas than from Texas to Calif. (God alone knows why. :) )

    • Yes you are right, I have now uploaded a correct version (thankfully only seconds work using the Alteryx module). Thanks.

  2. How do you determine what weight to apply? I want them all the same weight, but getting very large arrows and trying to figure out how to make them smaller. Appears you use a formula to calculate weight. Thanks

    • Glad you got this working Ryan, I’d love to see the result if it’s something you can share.

  3. Ahh, I figured it out. I was uploading the same file name, without clearing my cache, and the app was using my old file. So if I changed the datafile it wouldn’t change the results. Once I cleared my cache, between runs, it works perfect.

    Awesome, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>