The following post is a guest post by Peter Fakan, Tableau Developer at the Australian Institute of Health and Welfare.
9/20/2017
Switching Map Shapefiles Using Parameters and Calculated Fields
I’m sure we all have stories to tell about using spatial data in Tableau. Even Tableau is currently interested in finding out more about users experiences with mapping here. Tableau 10.2 introduced shapefiles as a new data source type. In this post, we will explore using more than one shapefile within your viz and swapping them with a parameter. Alan Eldridge has a similar post of this topic here.
Here are the steps needed to switch shapefiles using a parameter.
Step 1: Load the Shapefiles
Step 2: Create a Parameter
This parameter will allow the user to select different geographies.
Step 3: Create a Calculated Field
This calculated field accumulates all of the different geometry fields from the shapefiles, controlled by the parameter.
Calculated Field Name: Map
Formula:
Step 4: Build the Viz
Drop the new calculated field into the marks area of your viz on Details. In this example, I have also used the common field Ste Name16 on Color, to create common color across all 4 mapfiles. Don’t forget to show the parameter control.
You should now have a visualization that can interactively change the mapping geography. As a word of caution this can create extremely large data files (the size of these shapefiles used in this example alone is 69mb) which will have an impact on performance, but if you happen to know a friendly GIS developer you can ask them to simplify your shapefiles to remove extraneous vertices which may help a little.
You can give the viz a try and download it from here.
- Peter Fakan
A big thanks to Peter Fakan for writing this blog post and building a sample workbook. I hope you find this information useful. If you have any questions feel free to email me at Jeff@DataPlusScience.com