Skip to main content

Prepare Your Data for Geographic Analysis

Learning Objectives

After completing this unit, you’ll be able to:

  • Recall what type of geographic data is supported in Tableau.
  • Assign a Geographic Role to a field containing geographic data.

Before you build your map, you must prepare your data for spatial analysis. This means assigning certain data types, data roles, and geographic roles to your fields depending on the type of map that you want to create. In order to build a map, you must connect geographic data to Tableau.

Geographic data comes in many different forms. It can be as simple as uploading spreadsheets with columns of point locations in latitude and longitude coordinates, or named locations such as cities or postal codes. You can also work with more advanced data sets, such as shapefile or geoJSON files that contain actual geometries.

Tableau is installed with point and polygon data for the following named location types, also called Geographic Roles.

  • Worldwide airport codes
  • Cities
  • Country/Region
  • Counties
  • Territories/States/Provinces
  • US area codes
  • Core-based statistical areas (CBSA)
  • Metropolitan statistical areas (MSA)
  • Congressional districts
  • Zip codes and postal codes for select countries

Geographic data not installed in Tableau can be added to your visualization as latitude and longitude columns, or by connecting your Tableau workbook to a spatial file or database that can be joined to your data.

To learn more about the types of geographic roles supported by Tableau, see Assign Geographic Roles on Tableau Help.

Basic Map Building Blocks

To prepare your data for upload, make sure it contains a field with at least one of the geographic data types supported. It could look something like this chart.

Fuel Type

Postal Code

City

Level 1 Charger Count

Level 2 Charger Count

ELEC

98188

Seattle

162

105

ELEC

99252

Spokane

1

2

ELEC

98362

Port Angeles

0

11

ELEC

98816

Chelan

12

5

Notice that there’s a dimension, or category (Fuel Type); two types of geographic data (Postal Code and City); and two measures (Level 1 Charger Count and Level 2 Charger Count). With this data, we can map the quantity of level 1 and level 2 chargers in these cities and postal codes.

Assign a Geographic Role

Tableau automatically assigns a geographic role to fields with recognizable geographic names. You can see if a field has a geographic role assigned, as it will have a globe icon.

Data Source Pane header for fields with globe icons on fields with a Geographic Role applied.

But sometimes, Tableau doesn't recognize that your field is geographic data, and you must assign a geographic role to the field.

  1. Hover over the column of the field you need to change and expand the menu.
  2. Select Geographic Role.
  3. Choose the geographic category that best describes this field. For example, City or ZIP Code.

Field context menu accessed from the Data Source tab to change the Geographic Role of a field.

You can also assign a geographic role to a field from the Data pane on a worksheet.

  1. Open a worksheet.
  2. From the Data pane, right-click the field you want to assign a geographic role to. In this case, ZIP.
  3. Select Geographic Role, and then choose ZIP Code/Postcode.

Field context menu accessed from the Data Pane on a worksheet to change the Geographic Role of a field.

A geographic role is now assigned to this field, and the data can be used to build a map. You do that in the next unit.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈