Data Viz Done Right

September 29, 2017

London Bus Routes - The Benefits of Linear Geometries in Tableau 10.4

No comments
As I mentioned previously, one of my favorite new features in Tableau 10.4 is support for linear geometries. Think about it this way...let's say you want to plot a bus route. You can either:

  1. Plot each bus stop and connect the dots, or
  2. Create a single line for the entire path

What are the benefits of each?

Plotting Each Bus Stop

This method, which uses the Path shelf to connect the bus stops, allows you to indicate the name of each bus stop along the route. However, the drawback is that Tableau has to draw each bus stop. For London bus routes, this means drawing 28,270 marks then connecting each of those dots for the respective route.

Using Linear Geometry

This method, which creates a mark represented as a line for each bus route, results in only 736 marks (one for each route). That means you'll be significant performance gains. The drawback is that you lose the detail of each bus stop.

Which should you use?

It depends on the granularity you need. If plotting each point is important, the go with method A. If aggregating to the route is ok, then go with method B.

For this use case, I wanted to test both options. First, I went to the TFL website to download the data of every stop for every bus route (requires an account). The data comes as a CSV with eastings and northings, so I turned to my friend Alteryx for converting these into shapefiles.


I used this tip by Rob Suddaby from when he was in The Data School to convert the Eastings and Northings into a spatial object. From there it's simple to create either the linestrings for the entire route or points for each stop.

A quick Mapbox map added for context and we're done! One additional twist I added was to size the bus routes on the map based on the number of routes selected. This only works on the map with each individual stop. I'll be sharing this tip during my TC session in Vegas.

Have a play...enjoy!

No comments

Post a Comment