Sign in or start a free trial to avail of this feature.
4. Plotting Routes in Tableau
Plotting routes on a map can be very beneficial, especially when examining the customer behavior and movement. In this lesson, we learn how to plot the route of a yacht in the Mediterranean.
Plotting routes in Tableau
- For this chart, we need geographic coordinates and a column to order these points
- The ordering column can be a date field or a numeric field
- The geographic coordinates are initially added to the map
- The mark needs to be changed to LINE
- To join the lines correctly, we add the ordering column to PATH
- To improve visualization, you may want to include points and lines on the same chart
In addition to plotting points in Tableau, in certain instances, we may want to plot routes; for example, monitoring the routes of customers as they walk through a shopping center or a department store. In this example, I'm going to use data related to the route of a yacht as it travels around the Mediterranean. As I scroll over each data point, I can see the route that the boat takes during July, August, and then into September.
However, to get from the raw data to this final visualization is quite difficult but in this lesson, we're going to learn how to accomplish this task. Let's first take a look at the data. Each line in the data set represents a single location with longitude and latitude coordinance and a timestamp. Unfortunately, there are a few blanks that will cause some issues later on but we'll worry about this problem once we encounter it on our chart. What we need in Tableau is a feature that can link sequential points together based on the timestamp and this feature is called path.
Let's now go back to Tableau where I have the data ready to go. I'll start by adding longitude and latitude to the shelves.
And, in addition, I'll add time as the level of detail but I'll make sure to select minute because each individual row in the data set has this level of granularity and now I have all the data points from my data set mapped over Greece and Italy. To bring up the path feature, I need to flip my mark to a line and now I can select path and now I can drag time onto path.
But, again, I'll need to select minute. Now that I have the lines created on my chart, I'd like to overlay the individual data points on top of the lines and to do this I'm going to drag latitude onto the row shelf again and this time I'll flip the mark to a circle and now I'll simply add to dual access.
There we go, now our chart is almost complete. To join the remaining lines together, we need to deal with the nulls that we saw in the CSV file and, unfortunately, the nulls are creating breaks between the individual data points. To fix this, we can hit the nulls and select filter data and with the nulls now removed, we have the exact route of our boat for July, August, and September.
To make this chart a little easier to read, it might be worth adding a filter and also adding a boarder to this particular data point which I'll do here.
As you can see, the path feature is extremely useful when you have a series of data points that are separated merely by individual timestamps.
The path feature makes sure that this data is ordered correctly so you get the correct route of a customer as they pass through a particular area of interest.