Buffer Spatial Functions

In 2019, Tableau introduced three spatial functions: Makepoint and Makeline (in 2019.2) and then Distance (in 2019.3). In version 2020.1, Tableau has introduced another spatial function, Buffer, which allows you to visualise the distance around a point location.

Update: I recently created a video tutorial walking through how you can use Buffer functions for spatial analysis. The example used is finding an Airbnb in London that is within 500m of a EV charging point.

The Buffer calculation returns a spatial object that, when rendered on a map, looks like a circle mark, as shown below:

Buffers are not Circle Marks

However, a buffer is not a circle mark. When you resize circle marks in Tableau you are essential giving it an arbitrary size (using the slider bar shown below) and not a specific size defined by a unit of measure:

A buffer remains a fixed size – the size you give it at creation – and it will scale as you zoom in or out of a map, whereas a circle mark will resize as you zoom. For example, in the two images below on the left, the circles and buffers appear the same size, however, as I zoom out, the circles resize relative to the map, whereas the buffer remains the same size relative to the map:

Calculation Syntax

The buffer function takes three arguments:

  1. A spatial point (geometry)
  2. A radius (number)
  3. A unit of measure for the radius (“miles”|”km”|”m” | “ft”)

The good news is if you don’t have spatial points in your data file, you can create a spatial point using the Makepoint calculation (as long as you have latitude and longitude data in your file) and then nest that within the Buffer calculation, as below:

Trade Area Analysis

Buffers open up lots of spatial analysis possibilities such as looking at trade areas. For example, lets say I was thinking of opening a coffee shop in London so I wanted to know, for six available target locations, how many competitor coffee shops there were within a 350 metres radius of each of those target locations, this is an approach I could take.

  1. Create a file of existing competitor locations (inc. Lat, Long, ID)
  2. Create a file of my 6 target locations (i.e. shops available to rent)
  3. Create a buffer around my 6 target locations of 350 metres
  4. Join these two files using an intersect join to show the competitors in range of my target locations

Below, I’ll walk through these steps.

Existing Competitor Locations

Below is a map showing all the existing coffee shop locations in London. Note, this is dummy data!

Target Locations for a New Coffee Shop

And below are the six target locations that are available to buy or rent that I’m considering to open a new coffee shop at

If I add a 350 metre buffer around these target locations, it renders like this:

Create an Intersects Spatial Join

The next step is to join these two files using a spatial join and at the same time create the 350 metre buffers around the target locations, as shown above.

Below is what the join configuration looks like in Tableau. On the left side, I am using the following Join Calculation to create a spatial point from the latitude and longitude fields in the ‘Competitor locations’ file.

MAKEPOINT([Latitude],[Longitude])

On the right side I am also using a Join Calculation (accessed via the drop-down menu shown above), this time with the Buffer calculation, which includes a Makepoint calculation nested within it to, again, make a spatial point this time from the latitude and longitude fields in my ‘Target Locations’ file:

What does the Intersects join do?

When joining these two files, the intersects join will keep only those competitor locations that fall inside the buffer areas of the six target locations.

To demonstrate this, the below animation shows the competitors on the left and one target location, with a buffer, on the right. The join effectively brings these together, with their respective latitudes and longitudes aligning and then discards all those competitor points that are outside of the buffer.

Below is the result of the intersects join as it appears on the map in Tableau, showing all the competitor locations within a 350 metre radius of the six target locations:

This knowledge of how many competitors are within range of each target location can help inform my decision making of which location to select or whether to look at other locations.

Creating Buffers Dynamically

Another use can might require creating buffers dynamically by selecting points on a map. This can be achieved by nesting the Buffer calculation seen previously inside of a conditional (IF) statement that checks to see if each point in your file is in a set. If it is (True) then a buffer is created, and if not (False) then no action is taken.

The calculation to achieve this is shown below:

The set can then be updated using a Set Action on the dashboard that is triggered when you click on a point. Further more, once the buffers are created, they can all be resized using the parameters that were used in the above calculation. This can be seen in action below:

Buffer spatial calculations are a powerful addition to the toolset, allowing quick trade area analysis without any pre-processing of your data directly in Tableau Desktop for the first time.

The workbook used for the above examples is uploaded to my Tableau Public page and can be opened by clicking the image below:

Experimenting with this further, I was thinking back to some work I did last year using parameters as a data source to be able to draw lines between spatial points on a map (read more on that here).

That method allowed me to capture different attributes about each leg of a journey such as method of transport and distance and I thought this could be applied to buffers to capture different sizes and category types for each location, such as primary or secondary.

The below video steps through a possible use case of how this might work. It also makes use of the new Export buttons to easily generate a PDF file of a dashboard to be shared with others.

I recently gave a talk at the London Tableau User Group, which covered the Buffer calculation and Animated Transitions. The slides for this talk are available here.

Thanks,
Marc

Latest YouTube video
This video tutorial steps through how to create a dot plot in Tableau.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑