Shaping Data to Enable Point-to-Point in Tableau
Shaping Data to Enable Point-to-Point
Mapping point-to-point particulars on maps requires that your data support plotting and linking each point. Possible use cases for this style of presentation might include delivery truck routes, subway line activity, or city traffic flow. Similar presentations could be made using an image files for spatial plots of areas which are too small for maps. Real-world applications may require automation to collect time-stamped geographic points and could require millions of records. To plot customized points on a map your data must include:
- A unique key record for each location
- Location coordinates (longitude and latitude)
- Other interesting measures or facts related to the data
The next example will map point-to-point travel between two office locations. A line connecting each point will be color-encoded to express the duration in minutes at normal speeds required to traverse each segment between points. Figure 5.24 shows a sample data set with the necessary details.
Figure 5.24: Point-to-point details
The route in figure 5.24 starts in Stillwater, Oklahoma at point one and finish in Oklahoma city, Oklahoma at point eleven. If there were multiple records for each location, a combination of the location, the key record, and the time stamp can be used to identify unique points. In that case, the measures would need to be disaggregated (by accessing measures) so that the plot displays all the different times while each location was visited. Since the sample data set includes only one record per location, there is no need to disaggregate the measures to display all the records. Figure 5.25 shows the completed point-to-point plot.
Figure 5.25: Map view of the route
Notice that the line mark type is selected on the marks card. Point ID defines the order of the route and must be placed in the path button so that the line connects each point in the correct order. Placing the point ID on the label shelf causes the location point ID number to display on the map as well. The line connecting the route is color encoded by segment time duration.
Since this covers a large area, it would be helpful to provide two additional map views that zoom into the local areas surrounding the origin and destination, making more granular street-level detail visible as in figure 5.26.
The maps on the right of the dashboard show more road details around the starting and ending points. Pointing at any mark exposes a tooltip with additional information about the location. The main map view on the left shows the tooltip related to the end point of the route.
Figure 5.26: Route dashboard