Edit 17 Jan 2017 : Please note that with the upcoming release of 10.2 we are adding a native connector for shapefiles that will make this article obsolete. Please refer here for more information:
I was asked by a customer today to help them create a map worksheet that combined custom polygons with points:
Victorian Local Government Areas (LGAs) with customer locations.
This has been a particularly complex chart type to create – it’s fine if you are using built-in geographic roles that include “filled map” polygons but combining custom polygons with points has been a real bugbear, usually resulting in a scatterplot where you lose the background tiles. But I came up with an approach today that worked quite nicely – and the key element is the following image:
For those of you will poor eyesight, that’s a “null” 1×1 pixel transparent image. Here’s the technique:
First, you need to have both the point and the polygon data in the same data connection – effectively a UNION of the two data sets. For the above image the source data was an Excel spreadsheet:
Vertex points for the polygons:
and single point records for the points:
The custom SQL statement was:
The resulting output looked like this:
You then use this data to create a dual-axis map. The first axis is for the polygons and is straightforward (pay attention to the marks card):
The second axis is for the points, and this is where the fun starts. The point layer actually has points for both the polygon vertices and the point marks – we can tell them apart using the “type” dimension. However the trick is we don’t want to display the vertex points. We can’t filter them out because filters will apply to both axes. All we have to play with is the marks card. Here’s how we construct the second axis:
We use a shape mark and make the point indicator whatever we want (I used a filled circle). However we then use a 1×1 px transparent mark for the LGA vertices. You can download this file from here – then put it in your My Tableau Repository\Shapes folder to make a custom shape palette. The result is what you see above – the vertex points are actually there but they are invisible. And we have custom polygons and points and background map tiles together at last. Huzzah!