What are spatial functions in Tableau?

Spatial functions allow you to perform advanced spatial analysis and combine spatial files with data in other formats like text files or spreadsheets. In this blog, I’ll show you how to use the spatial functions in Tableau to create lines and points on the map based on airport data.

 

Sample

We are going to create the below chart. The data is available here.

Figure 1. Sample

 

Steps to re-establish the chart

a) Create Start Point

Create Start Points based on the latitude and longitude of the origin airport.

Figure 2. Start Point statement

 

b) Select the Sydney Airport

Double-click the <Start Point> to show all the origin airports on the map.

Figure 3. Show Start Points

 

Right-click the <Name Origin Airport> and select Show Filter.

Click the top-right drop-down Botton of the filter and select the Single Value (list).

Type ‘Sydney’ to find the Sydney Kingsford Airport.

Figure 4. Locate Sydney Kingsford Airport

 

c) Create End Point and Show them

Create End Points based on the latitude and longitude of the destination airport.

Figure 5. End Point Statement

 

Drag the <End Point> to the Marks Layer button.

Figure 6. Add End Point to Marks Layer

 

Then we can see the Sydney Kingsford Airport Point and its corresponding Destination Airport Point.

Figure 7. Show End Points

 

d) Make Lines between the Start Point and End Point

Create lines.

Figure 8. Lines Statement

 

Drag the <Journey> to the Marks Layer button.

Then we can see the routes.

Figure 9. Show Lines

e) Create a Buffer

First, create a parameter of radius.

Figure 10. Radius Parameter

 

Create the Buffer based on the origin airport.

Figure 11. Buffer Statement

 

Drag the <Buffer> to the Marks Layer button.

Figure 12. Show Buffer

 

f) Color the routes within the buffer

Create the adjustment calculated field.

Figure 13. Within Buffer Statement

 

Put it on Journey’s Color Marks card.

Figure 14. Color the routes within the buffer

 

g) Show details

When you hover over the lines and destination airports, you always select the whole lines & end points.

Figure 15. Hover on the lines

 

Figure 16. Hover on the End Points

 

To show all the details, we should put <Name Destination Airport> to Journey and End Point’s Detail of the Marks card.

GIF 1. Show details of lines & End Points

 

h) Format the Start Point and End Point

We can format the start and end points to distinguish the origin and destination airport.

Change the Start Point to Circle in Marks Card. Increase the Size and edit the Color.

Change the End Point to Shape in Marks Card. Select Star Shape and edit the Color.

Then we can get the final chart.

Figure 17. Final Chart

 

If there are any problems, please feel free to point them out. Besides, you can reach out to me on LinkedIn. I will try my best to answer your questions about Tableau or Alteryx.

 

Joe Chan
Author: Joe Chan

Joe has an IT background with a master's degree in UNSW, majoring in AI and Data Science. During his studies, he realized Data is one of the most valuable assets a business can have and potentially has a tremendous impact on its long-term success. After graduation, his desire to level up his data analytics skills led him to join The Data School. He is interested in Data Wrangling, Data Visualization, and Machine Learning, eager to be a great Data Analyst to help businesses grow.