Ever thought of creating a map in Tableau which connects you source and destination locations along a specific path??

Featured Image

Tableau has the capability of plotting the coordinates of a particular location which can be simply achieved using the simple latitude and longitude of the location. But, in order to define a route which connects the two locations, we need to render information about the course of paths/routes/roads taken to travel from end-to-end locations to Tableau.

To do so in Tableau, along with the geo-coordinates of the source and destination locations, we need to gather the GPS data about the entire path/route/road which would draw a line (based on GPS data) and connect the source destination points making it look like a route.

Collecting the required data and shaping it for the case is the most important task for this visualization. The viz creation is very easy and Tableau takes care of everything for us.

First of all, you need to convert your route information into GPS co-ordinates. If you do not have clue how can that be done, then read the post How to generate GPS co-ordinates of a route?” which will help you understand the process.

I have the required data which needs to be used for this demonstration.

Let me walk you through the data before we start building the map, because it’s also important to understand the data before we bring it to visualization. To create this viz, i am using the below columns, namely, PATH ID, LATITUDE, LONGITUDE, TRIP ID, TRIP DESCRIPTION and LOCATION NAME.

Image 2 - Understanding the data

LATITUDE, LONGITUDE columns have my geo-coordinate data for entire route. In the LOCATION NAME column, I have just labelled the starting and the ending points of the trip so that they can be easily displayed on the map in Tableau’s Labels. TRIP DESCRIPTION has the short start-end details.

To maintain the uniqueness of the different trips, I have given them with a unique TRIP ID.Image 3

Last but not the least the PATH ID column, this will uniquely identify each rows of latitude-longitudes pair as one point and plot each such pairs on the map.

Since the latitude and longitude pair information in a unique trip is in continuous series the points plotted from each latitude-longitude pair creates a route for us, which is what we are looking to do.

Also, not to connect every individual trip to one-another, the PATH ID must start over with every new TRIP ID.

Let’s see how this can be done on tableau:

  • Drag and drop the Latitude and Longitude measures on Rows and Columns shelves respectively.  As soon as we do that we can see there are points generated for each latitude- longitude pair on the map, which resembles like a route.
  • I have two trips in my data set so I will pull out my TRIP ID column to filters and will also show them on filters for selection.

Image 4 -filter

  • Next, change the MARKS from Automatic to Line and drop the PATH ID on the Path in Marks card Shelf. This action converts each latitude-longitude pair points on the map as a continuous line which starts and end at our specified locations and makes the route for us.

Image 5 - Path

  • Finally, I drag and drop the LOCATION NAME dimension on to the Label which gives a nice start and end point label to my route on the map.

Image 6 - final

You can download the workbook from Tableau Public.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s