Creating Route Visualizations on Tableau
The purpose was to create visualizations of routes with customers and total orders. The client also requested the ability to drill down by route, select dates, and view zip codes. The client requested polygons to represent the routes. This request is addressed in the tutorial.
We needed to create a route map, with a closed route or polygon. The routes represent delivery routes with customers at each stop. Unique customer data will be included in the tooltip at each stop. The map will be built out with individual maps for each route. The closed loop or polygon request was specific and not easily referenced in previous Tableau documentation, so we are sharing our workaround for this. There is documentation for “Create Maps that Show Paths Between Origins and Destinations in Tableau”. We referenced this documentation while finding a way to indicate a polygon.
There is a polygon option on the Mark Card, but we did not find it sufficient for the route. It did not indicate that the routes were comprised of smaller units(customers or stops). Ideally, we wanted customers represented and the ability to associate data points with the customers. Below you can see the polygon mark vs the path workaround described below.
The workaround starts in the data source. In addition to the standard latitude and longitude headers, add Route, R_Path, and Origin.
Route- Indicates which delivery route, etc the row
R_Path- The order of the rows (customers, stops, data points) on the route
Origin – Indicates if this is an origin.
Where R_Path = 1, repeat the row at the end of the route. This will complete the polygon and close the route. See the highlighted rows below.
The Tableau Set-Up:
A complete screenshot is below including marks and filters. This can serve as a foundation, with more data added to the tooltips, labels, and filters.
- Load the Excel sheet or CSV from above into Tableau.
- Assign Longitude (Columns) and Latitude (Rows) to the Columns and Rows on the worksheet as indicated.
- Drag the Route dimension to Color on the Marks card.
- Assign “Path” from Data to Detail on the Marks Card.
- Change the Marks from Map to Line.
- Select the detail next to “Path” and select path.
- Select Path from Marks Options (see below). Then select the first line type. Additional adjustments can be made by selecting Color and Size.