This article is going to focus on some of the mapping updates Tableau has made over the last few releases. I’ll demonstrate how you can zoom in to particular areas of interest and see an incredible level of detail. You can do this using the map functionality but also through the use of set actions or filter actions. I’ve decided to use a public data-set from Google BigQuery. This contains information pertaining to collisions in New York, provided by the NYPD. Google BigQuery is one of Tableau’s native connectors (more on this here and here) so this was quite easy once I figured out how to search for the data-set having set up an account and connecting. See below how the connection was set up:



Visualising the data

The data-set contains data from 2012 to 2019 and had 1.5M rows. For demonstration purposes I’ve narrowed the analysis to focus on incidents in 2018, where cyclists were either injured or killed. It’s important to note that a portion of the rows (approx. 6%) did not contain Longitude or Latitude coordinates so couldn’t be displayed on the map. The image on the left shows the unique incidents at the location they occurred (see this tutorial on basic mapping if you’re not familiar with how to create this chart type). We can’t discern which areas had a higher concentration of incidents however, which is where the new ‘Density’ mark type introduced in version 2018.3 becomes beneficial. On the right I have simply changed the mark type to density, which allows us to see the zones of higher concentration in yellow and red, with the highest concentration in lower Manhattan (if you have some familiarity with New York). I have chosen the ‘Satellite’ map layer which is one of the recent enhancements with the arrival of version 2019.2.


Zoning in on areas of interest

Visualising the data as above allows us to see a clear pattern. If we needed a better understanding of the areas most impacted we would likely want to zoom in on these areas. One option is to use the ‘Pan and Zoom’ options available through the View Toolbar. I find this can require a number clicks and you sometimes lose the bigger picture. My first instinct was to want to filter out the areas of lower intensities. There currently isn’t a way to filter based on the density to my knowledge. In the absence of this, I tried out three different options which I’ll go through below.

A Set Actions

Set Actions arrived in 2018.3 and have been widely written about in the Tableau Community (see blogs from Bethany Lyons, Lindsey Poulter, Andy Cotgreave and Shaun Davis. There are many use cases, one of which is to zoom into an area on a map. This allows us to dynamically choose which marks we want to zone in on, and then revert to the original view. Vector maps were introduced in version 2019. 1 and have improved this experience, showing a great amount of detail quickly and smoothly. One draw back to using set actions in this instance is that the density of the locations can then no longer be compared, due to the fact the marks remain selected (see left). One way to add the ability to compare the marks at this level would be to add a measure to size (see right where you can see some circles are bigger). You can’t add a measure to size on the marks card while the Density mark type is selected, so you need to create a dual axis chart. I have added a calculation to count the number of incidents at each location using a ‘Fixed’ Level of Detail (LOD) calculation which I will elaborate on in the last section below. You can view this dashboard on Tableau Public here.

B Filter Actions

Another approach would be to use a filter action in a dashboard. In this example I have added two worksheets to one container, and created a filter that is invoked when you select marks on the left. The map on the right is then filtered so you only see the marks selected. The benefit I see to this approach is that you can retain the context on the left, while zooming in on a particular area. Furthermore the density of the locations is still visible so you can see the areas most impacted and look at streets, intersections and points of interest. I have then selected to ‘Exclude’ any data once the filter is removed, so the view on the right then disappears. This iteration of the dashboard can be found when you select ‘B FilterActionZoom’ here.



C Standard Filtering with an LOD calculation

While the two approaches above allow you to investigate further, guided by the colour in the heatmap, if might be useful to filter out the areas of lower density so you can focus on the areas of higher density. If for instance you were coming up with a strategy attempting to tackle the number of collisions in general, or you wanted to highlight areas that cyclists should be aware of, you would need to prioritise areas most affected. The solution I came up with here is to count the number of unique incidents that occurred at each location. You need to do this with a Level of Detail (LOD) expression as the calculation needs to occur at a level of detail higher than what’s present in the view (the view contains a unique key for each incident so the count for each mark would simply be ‘1’ without an LOD expression). The requirement here is for a ‘Fixed’ LOD expression. I wanted to calculate the number of unique incidents at each location so the syntax was as follows: { FIXED [Location]: COUNTD([Unique Key])}. I had to ensure that the other dimension filters were put on context in order to calculate the correct amount when the views were filtered. I’ve written previously about context filters and Tableau’s order of operations here. This final iteration of the dashboard can be found when you select ‘C FilterDensity’ here.

It’s relevant to note that this data doesn’t contain any information regarding traffic so it’s not possible to determine if the worst affected areas are inherently more dangerous, or if the volume of vehicles of all types is higher in these areas thus driving up the number of incidents. We would need more data to enable richer analysis.


Thanks for reading and feel free to let me know your comments!