Knowledge Base

Product(s): Tableau Desktop, Tableau Public
Version(s): 8.0, 7.0, 6.1, 6.0

Article Note: This article is no longer actively maintained by Tableau. We continue to make it available because the information is still valuable, but some steps may vary due to product changes.

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:

1. Obtaining the outline coordinates of the regions of interest.
2. Creating a table of these coordinates in the decimal latitude and longitude format.
4. 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

### Step 2

Start a new workbook, click Connect to Data > Import from Workbook, and navigate to and select PolygonMaps.twbx.

### Step 3

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:

1. In the Data window, right-click the connection and select Edit Tables.

2. In the Tables dialog box, select Polygon\$ and click Edit.
3. 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.

4. Close any open dialog boxes without making any changes.

## Create a polygon-shaded map view and variations

### Step 1

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.

### Step 2

On the Marks card, in the list, select Polygon.

### Step 3

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.

### Step 4

From the Dimensions pane, drag STATE to Color, and then drag another instance of STATE to Detail.

### Step 5

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