Creating Polygon-Shaded Maps
Version(s): 8.0, 7.0, 6.1, 6.0
Last Modified Date: 21 Mar 2013
You can create polygon-shaded maps using geocoding that is built into Tableau Desktop. This article describes how to create a view with shading on custom areas, completing the following procedures:
- Obtaining the outline coordinates of the regions of interest.
- Creating a table of these coordinates in the decimal latitude and longitude format.
- Linking the table with your current data.
- Setting up a Tableau workbook with the polygon mark type to shade the regions of interest.
You will need the attached workbook, PolygonMap, to complete this exercise.
About the Polygon Map data source
The Excel workbook used for this example contains two worksheets. The Orders worksheet contains data for 10 sales: Order ID, Date, Sales, and Customer State.
In the Polygon worksheet:
- [State] is used as the key field to link with the data table.
- [Vertex Type] is optional.
- [Latitude] uses the decimal format.
- [Longitude] uses the decimal format.
- [Point Order] tells Tableau in what order to draw the outline.
- [Polygon Number] is used to draw separate polygons for states that have multiple land bodies, such as islands.
See how the data tables are joined
Download and save the attached workbook PolygonMap.twbx.
Start a new workbook, click Connect to Data > Import from Workbook, and navigate to and select PolygonMaps.twbx.
The Data window shows dimensions and measures from two tables. In this example, the tables were joined on Customer State from the Orders table and STATE from the Polygon table, using a left join.
To see how the tables are joined, complete the following steps:
In the Data window, right-click the connection and select Edit Tables.
- In the Tables dialog box, select Polygon$ and click Edit.
In the Edit Table dialog box, click the Join tab, and see the join clause that indicates the tables are joined on the Customer State and STATE fields.
- Close any open dialog boxes without making any changes.
Create a polygon-shaded map view and variations
In the Measures pane double-click LONGITUDE and then double-click LATITUDE.
Tableau adds Longitude to the Columns shelf and Latitude to the Rows shelf.
On the Marks card, in the list, select Polygon.
From the Dimensions pane, drag POINTORDER to Path on the Marks card.
Note: By default, the POINTORDER and POLYGON NUMBER fields were measures. In this workbook, they are converted to dimensions. To do this, you right-click the field in the Measures pane, and select Convert to Dimension.
From the Dimensions pane, drag STATE to Color, and then drag another instance of STATE to Detail.
At this point, the upper islands of Wisconsin are not shaded and the border with the Upper Peninsula doesn’t look right.
To correct this problem, from the Dimensions pane, drag POLYGON NUMBER to Detail.
Here are two more ways you can use shading based on custom region.
To use gradient shading based on sales, from the Measures pane, drag Sales to Color, to replace the existing STATE field.
To make the map labels visible through the shading, adjust the transparency slider for Color.
Alternate Search Terms:Data Sources Maps