Spatial data is rarely touched upon in Tableau but when using such data, Makepoint and Makeline calculations can become very important. Both calculations are self-explanatory with Makepoint being a calculation that creates a point whilst Makeline creates a line between two points. This blog post will go through how use both calculations using Airline Routes in the US.
Step 1:
When loading up the data source, you have Origin and Destination fields that allow you to create a MakePoint for both as shown below.
Usually MakePoint functions include Latitude and Longitude and for this example that will be the case. However, there are instances where both can be replaced with x and y co-ordinates. To create a MakePoint calculation for this data set and for the Origin fields, create a calculated field and type the following:
MAKEPOINT([Origin Latitude],[Origin Longitude])
(Note: Latitude always has to come before Longitude in Tableau spatial calculations). You can title this calculated field as Origin. Once you have done that, you can create another calculated field (titled Destination) and have the following in the calculation box:
MAKEPOINT([Dest Latitude],[Dest Longitude])
Step 2:
You can now create a line between the origin and destination to look at the path that flights took using the Makeline function. The function is very similar to the Makepoint syntax with there being two fields inserted after writing out the calculation. The first field in the bracket represents the start point whilst the second represents the end point. For this example, the Makeline syntax that has to be created in a new calculated field should look like this:
MAKELINE([Origin],[Destination])
You can title this calculated field as Path.
Step 3:
To create a map with the Makeline function to look at the path of flights, just double-click on the Path field that we have created and the map should look like this:
At this point, the map is just one mark. In order to seperate that, you can drag in different fields like Airline into the marks for a more detailed look.