Create Points and Lines in Tableau

by Jose Valero

In my last blog posts, I explained how to create points, lines and calculate their distances using Alteryx.

In this one, I also want to show how to create points and lines using Tableau. As for calculating the distance, tableau does not have that feature yet, but it seems that it will appear in future versions.

For this example, we will be using flights data, more specifically, Flights routes from UK airports.

Our goal is to draw lines from our UK airports to all the destinations they offer.

I have downloaded flight data from https://openflights.org/data.html, clean it and prepare it a bit for this example. Download here if you want to follow along.

We can see that our data has Origin airport and Destination Airport and their Latitudes and Longitudes.

Load the data into Tableau and let’s Start!

Create points

We are going to use the Latitudes and longitudes to create all the centroids (points) for both Origin airport and Destination Airport.

Let’s create two Calculating fields using the function “Makepoint”. The “Makepoint” function ask you for the Latitude and Longitude.

“Makepoint” uses latitude and longitude fields in a spatial join, creating a centroid.

Makepoint([LAT],[LON])

Create Lines

After creating the centroid for each the Destination and Origin airports, we will connect both points with a line using the “Makeline” function, which creates a line between two points, an origin and an end.

Clean the view

Now we have too many lines, and we can’t see much with clarity. You can now clean the data your way.

In my case, I will reduce the opacity and add a filter so I can choose the airport I am interested in.

Hope this blog post helps you understand a bit more the two function “Makepoint” and “Makeline”, as well as which destination you can visit from each airport within the UK. 😊

Thanks,

Jose

Avatar

Jose Valero

Fri 23 Aug 2019

Thu 22 Aug 2019

Wed 21 Aug 2019

Mon 19 Aug 2019