Spatial functions are a set of tools and processes used to analyze data that contains a geographic or spatial component. We can use Tableau to analyze and visualize spatial data to create interactive and visually appealing dashboards and reports.

There are several reasons why spatial functions and Tableau can be useful:

  • Enable us to perform various spatial analysis tasks, such as proximity analysis, spatial clustering, overlay analysis, and spatial joins.
  • Ability to create maps and visualize spatial data
  • Support making informed decisions by providing actionable insights derived from spatial data.
  • Allow to integrate spatial data with other non-spatial data sources, enabling us to analyze and visualize data from multiple perspectives

Now, let’s see how we can create a buffer function in Tableau.

Example: Let’s say we want to determine how many public high schools are within a certain distance (10km) from an address.

Step 1:

Let’s look at the data. Here, you can see that we have Latitude and Longitude as spatial data fields. As the first step, we are going to join our school data with the home address. Here, I have two data files: Public_schools.csv

Step 2:

Now, we are required to create points of schools using above mentioned spatial fields. In order to do that, first let’s create a calculated field named ‘School points’

Step 3:

Next, let’s drag the created calculated field ‘School points’ to details card. It will automatically generate a map with all the school points as below.

Step 4:

Let’s add the ‘School_ID’ to detail card, so we can identify each point by school ID.

Step 5:

Then, we can create a calculation to identify the point of home and then create the buffer. Here, we can do it in two ways as we are considering only one location.

We will use following details as the home address.

Address City State Latitude Longitude
W 12th Street New York USA 40.73765 -74.0024

 

  1. Creating a Home point as a separate calculation. Here we are using the ‘Makepoint’ function.

Let’s drag the home point to the map layers. Here, we can do some formatting. In order to stand out from the rest, here I have selected a different shape and colour. So, the red cross here represents the home point.

Then, we can create the buffer calculation using the created home point. Then, we have to pass the distance that we are considering, which is 10 and we also have to pass the unit of measure which is 10km in this scenario.

2. Otherwise, we can easily pass the latitude and longitude to the buffer function directly as below. However, this will be effective when there’s only one point that we consider.

Step 6:

We have already got two layers in the Map.

  1. School points
  2. Home point

Now we can add the third layer, which is our buffer. Drag the buffer calculated field to Map Layers and we can see the schools around 10km radius around the home point.

Step 7:

As the final step, we can show the number of schools within the buffer. To do that, we can drag the Count of School IDs to Label card and let’s do some formatting like changing colour of the buffer and reducing the opacity. Once we do that, we can get a final view like this:

So, now it’s your time to play around with buffer function.

The Data School
Author: The Data School