Hi, thanks for reading! This newsletter is all about using Tableau in unique ways (ie. not what you typically find in YouTube tutorials, blog posts, and community forums, etc…). I’m calling it Weird Tableau because I couldn’t think of anything better. I hope you find it helpful, interesting, entertaining, and all that other good stuff. And if you do, please share and subscribe!
Ok, so this isn’t a standard post. No full Weird Tableau case study this week. Instead, I’m writing about a solution to a mapping issue I encounter fairly often when practicing weird Tableau. Let’s get started!
I make a lot of maps in Tableau. I have a background in GIS and I love pushing the limits of what Tableau can do with geospatial data.
One of the best ways to level up your Tableau mapping is to incorporate Mapbox. Mapbox is awesome! I like to describe it as the marriage of geospatial and graphic design software but that’s probably selling it short. Most often, I use Mapbox to build basemaps that match my clients' branding or when I want certain basemap layers to only be visible at specific zoom levels (zoomed out/zoomed in). I also use it as an alternative to mapping lots of polygon data directly in Tableau. I’ve found that mapping thousands of polygons slows down dashboard performance (e.g. census blocks for a large city or county). A good workaround is to put the polygon layer in your basemap with Mapbox, then map the centroids of the polygons as point features in Tableau (Tableau automatically defaults to the centroid when you display polygons as a circle or other shape, you don’t need to calculate it). However, an issue arises with sizing the circles. In the example below, I’m showing individual parcels within a city as circles on the map. Each parcel is associated with a neighborhood. There are over 10,000 parcels, so to keep the map from looking cluttered when it’s zoomed out, I need my circles to be tiny but when I filter the map to a neighborhood, the circles are so small, you can hardly see them.
Now there are a few things I could do here. I could adjust the circle size to find something that looks reasonable at both the city and neighborhood level. But, some neighborhoods have just a few parcels and others have dozens, that makes this approach tough. I could choose a dark base map to create more contrast with the point colors. This works but it’s not ideal and I’d rather not compromise. What I truly want, is the circle size to be really small when the map is showing parcels across the whole city and bigger when it’s zoomed to a neighborhood. Let’s discuss…
Step 1: We want to filter the map by neighborhood so the first step is to set that up. Rather than using a quick filter, I’m going to use a parameter as the filter (you’ll understand why in the next step). I create a string parameter called neighborhood selection, choose “List” for the allowable values, then I add values from the Neighborhood field. Lastly, I type the value “All” into the list.
Step 2: Time to create the field that will magically turn the parameter into a filter. It looks like this and returns T/F. I drop it on the filter shelf and select T.
Step 3: Now, I need to create a calculated field to filter the map and determine the size of the circles. The circle size will depend on the number of parcels in my map. When the map is showing the whole city, I’ll have over 10,000 parcels in my view and those circles need to be small. When it is focused on a neighborhood, there might be just a handful or over 1,000 so the ideal size will vary. Here’s what that looks like, along with some handy thought bubbles to explain my thinking…
Step 4: Drop that calculated field on the size shelf and adjust the size range to your liking. That’s it! Here’s what it looks like and notice how you can see the parcel polygons in the Mapbox basemap.
Thanks for reading, I hope this is helpful!
Here are some useful links if you want to learn more about Mapbox and Tableau
Adding custom Mapbox maps - Playfair