Points and Polygons

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!

About Alan Eldridge

Hi. I'm Alan. By day I manage the APAC sales engineering team for Snowflake Computing. By night, I'm a caped crusader. Or sleeping. Most often it's sleeping.
This entry was posted in Uncategorized. Bookmark the permalink.

15 Responses to Points and Polygons

  1. Pingback: Labels on custom polygons | Alan@Tableau

  2. This was extremely helpful, and will be very useful in my current work with exploring the possibilities with Tableau.

  3. Pingback: Using Shape Files for Boundaries in Tableau | The Last Data Bender

  4. Simon K says:

    With Tableau 9 and it’s built-in LGA support, what steps would I take to put my “customer locations” on top of thematically mapped LGAs?

    • Hi Simon,

      I’m assuming you are asking how to co-plot lat/lon values you have in your data set (e.g. locations of your customers) with the built-in LGA boundaries in Tableau. Is that correct?

      If so, I don’t think you’ll be able to as you can’t create a dual-axis map where each axis uses a different lat/lon field. If you use the built-in LGA data then this will place the (generated) lat/lon fields on the viz and you can’t combine them with lat/lon from another field.

      To achieve this you would need to use the custom polygon LGA boundary data listed at https://blog.databender.net/2014/08/03/australian-region-boundaries-in-tableau/ and use the technique at https://blog.databender.net/2014/06/23/points-and-polygons/ to combine the point and the poly data into a single map.

      Unfortunately you’re at the edge of the envelope regarding what we can easily do.


      • Simon K says:

        Thank you for your reply Alan! You are right, I do indeed want to plot my lat/long “customer locations” on the custom polygon LGAs.

        When I go through the steps in the above post, can I filter my “customer locations” by the variables included in my excel file (revenue, service type, etc.) as well as have the LGAs show data (such as total population)?

  5. Hi Simon,

    Sure – you can do that. I expect that you will need three data sources…

    One is the spatial reference data set that will contain the boundary data points for the LGA regions as well as the point locations for your “customer locations”. Two is the demographic data for the LGA, keyed by the LGA name/code with the metrics you want to use to colour the polygons. Three is the customer attributes, keyed on customer. I guess you could include the customer attributes in data source one – it’s up to you.

    You use the spatial reference as the primary and blend to the other two to get the attributes you want to colour/filter by.

    Hope this helps.


  6. Simon K says:

    Thank you for this, Alan. I am slowly gaining an understanding of how to do this (reading up on vertices and polygons for starters) . As a newbie I still struggle even with the basis questions:

    How do I turn the polygon file (such as POA_2011 or LGA_2014) into an excel sheet for the merger through a custom SQL statement?
    How and where do I run the custom SQL statement in Tableau?

    As of now this blog post is sadly too high level for me a one by one instruction would be extremely helpful.

  7. Pingback: Points and Polygons in Tableau 10.2 | The Last Data Bender

  8. Mohan says:

    Hi Alan,

    This is a great post, thanks !

    I’m fairly new to Tableau and am working with version 10 (Could not get the 10.2 beta version). I have managed to follow your post and create the visualisation with the data points overlaying the polygons.

    My only problem now is that,
    The map for the first axis (Polygon) is plotting a line that connects the ‘Points’ data as well. As a result, the dual axis map shows a polygon connecting the points within the Actual polygon.

    Please see image at https://ibin.co/3AdPvUwmojwP.png


    • Hi Mohan,

      Glad you found the information useful. It’s hard to be certain just viewing the image but I’m guessing that the field you are using as PolygonID (i.e. uniquely defines the polygon so the path across the points is done for just this group). Can I suggest that you ensure that this field is unique for each point that you want to plot? That way the viz will be plotting a polygon of only 1 point which won’t display.

      Let me know how you go.


  9. Pingback: How to geocode thousands of addresses and make a Tableau custom polygon + point map, with a little help from FME » Tableau Picasso

  10. Pingback: How to geocode thousands of addresses and make a Tableau custom polygon + point map, with a little help from FME - Vizable Insights

Leave a Reply to Alan Eldridge Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s