Tableau Outline Spatial Function

The collection of spatial functions in Tableau expanded again with the release of version 2023.2 with the addition of two new functions: 

  • OUTLINE() – “Turns polygons (including those within multipolygons) into line strings.”
  • SHAPETYPE() – “Returns a string describing the structure of the spatial geometry, such as Empty, Point, MultiPoint, LineString, MultiLinestring, Polygon, MultiPolygon, Mixed, and unsupported.”

Definitions are from Tableau’s spatial functions help page.

In this blog post, we’ll take a closer look at the Outline function. 

Firstly, a thank you to Tableau Visionary HoF, Jonathan Drummey (@jonathandrummey), from whom I learnt about these new functions and also for the example use case he shared that inspired an example I’ve used below.

A polygon and its outline

Below is an image of a polygon on the left and line string outline of the same polygon created with the Outline function.


Here’s the Outline function that takes one geometry argument.


The polygon, above left, does already have a red outline and it can be turned on or off and the colour changed using the colour marks card


However, it’s not possible to change the width of the outline or to encode the colour of the outline with a separate field or parameter. And that’s two capabilities we gain with the new Outline function.

Populations of London Boroughs

So how might we use this new feature? Below is a simple dashboard with a bar chart showing the population of each London borough and a map showing those same boroughs.


When you select one or more bars, the outlines of the corresponding boroughs are highlighted on the map. 

This design can help the user make the connection between the analytical information in the bar chart and the spatial information in the map

Only show selected borough outlines

A set named Selected Borough is used to hold the codes (in the spatial file) associated with each borough that has been selected on the dashboard and a set action is used to update the set when selecting the bars.

The Borough Outlines calculation then references this set to only return a line string object if the borough code is in the set:

Above or below average

Instead of manual selection to colour the outlines, they could be colour encoded based on a categorisation. This example uses a boolean calculation to determine if the population of each borough is above or below the average population across all London boroughs. 


Alternatively, a continuous measure could be used to encode the divergence of each borough’s population from the average

Adding the outline spatial object as a map layer

The examples above were all created using Map Layers with one layer showing the polygons:


And a second layer showing the outlines. 


It’s always good to see more spatial features in Tableau and I hope this was a helpful introduction to this new function. 

The workbook is downloadable from my Tableau Public page.

Be notified of new content…

If you find these Tableau tips and tutorials useful, you can follow me on LinkedIn for all the latest content.

Thanks,
Marc

The recent release of Tableau 2024.1 includes an update to spatial buffers and you can now create these buffers around line string objects.

Click here to learn more…

Comments are closed.

Create a website or blog at WordPress.com

Up ↑