Tableau supports not only using geographic map tiles, but also drawing and display custom polygons (or closed shapes). This can be helpful when visualizing or emphasizing certain areas in a map or background image.
In this recipe, we will draw custom polygons around two points of interest in Vancouver, Canada:
To follow this recipe, open B05527_05 – STARTER.twbx
. Use the worksheet called Custom Polygon
, and connect to the Vancouver Points of Interest
data source:
Here are the steps to create the custom polygon areas:
A polygon is a series of points that are connected together to form an enclosed space. To create custom polygons in Tableau, there needs to be a series of points – pairs of x and y coordinates—and a sequence that indicates in which order to walk these points.
In our recipe, I created the points using Interworks' Drawing Power Tool (http://powertoolsfortableau.com/tools/drawing-tool). This is a great online tool that allows you to draw your custom shape on a map or a custom image:
I've produced my point data using the Table format, which can be seen on the website's left-hand section. I copied these points to Excel. The original points look like this:
To help more easily draw this in Tableau, I added another field, called location. I also changed the shape column header to shape id, so that Tableau will interpret this as a dimension by default instead of a measure:
Once this is set up, we simply need to connect to this data source. The latitude and longitude represent the x and y coordinates, respectively. When you double-click these, latitude will be assigned to Rows and longitude to Columns. The shape id will identify each enclosed shape, and the point will specify the path to walk (or the sequence of points to connect).
3.133.158.32