askvity

How Do I Add Geography in Tableau?

Published in Tableau Geography Maps 4 mins read

Adding geography in Tableau, primarily to create powerful maps, involves connecting your data, ensuring Tableau recognizes your location fields, and then building your visualization. The core process revolves around assigning specific geographic roles to your data columns.

Steps to Add Geography and Create Maps in Tableau

Here's a breakdown of the key steps to add geography and visualize it on a map in Tableau, based on standard procedures:

Step 1: Connect to Your Geographic Data

Begin by connecting Tableau to your data source. This data source must contain information that Tableau can interpret as geographic locations, such as:

  • Country names
  • State or Province names
  • City names
  • Zip Codes or Postal Codes
  • Latitude and Longitude coordinates
  • Custom geocoding or spatial files

Step 2: Join Your Data

If your geographic information is in one table and the measures you want to visualize on the map (like Sales or Population) are in another, you will need to join these tables within Tableau. Ensure the join is made on a common field (e.g., a Location ID or Name) so that Tableau can associate the geographic data with your quantitative data.

Step 3: Format Your Geographic Data in Tableau

This is a critical step where you help Tableau understand which fields represent locations.

  • Change the Data Type of a Column: While geographic roles are paramount, sometimes ensuring the field has the correct data type (like String for names or Number for codes/coordinates) can be helpful, although Tableau often infers this correctly.
  • Assign Geographic Roles to Your Geographic Data: This is the most important action. Right-click on a data field in the Data pane that contains geographic information (e.g., 'State' or 'City'). Go to Geographic Role and select the appropriate role from the list (e.g., State/Province, City, Zip Code, Latitude, Longitude). Tableau uses these roles to look up locations in its internal geocoding database or to plot coordinates directly. Fields with assigned geographic roles will display a small globe icon next to them.
  • Change from Dimensions to Measures: While not directly adding geography, if you need to use geographic data like Latitude or Longitude as a measure (often required for custom spatial data or specific coordinate plotting), you might need to change its classification from a Dimension to a Measure. Typically, geographic names (like State or City) remain Dimensions.

Step 4: Create a Geographic Hierarchy

Once geographic roles are assigned, you can create a geographic hierarchy. For example, you could create a hierarchy containing Country, then State/Province, then City. This allows you to easily drill down into geographic areas on your map visualization. To create one, drag a geographic field onto another geographic field in the Data pane and name the hierarchy.

Step 5: Build a Basic Map

With your geographic data properly formatted and roles assigned, building a map is straightforward:

  • Simply drag the geographic dimension (e.g., 'State', 'Zip Code', or the Latitude/Longitude fields) from the Data pane onto the view. Tableau will automatically generate a map visualization.
  • You can then drag measures (like 'Sales' or 'Profit') onto the map to visualize data spatially (e.g., using color, size, or labels).

By following these steps, you enable Tableau to recognize and plot your location-based data, allowing you to create insightful geographic visualizations.

For more detailed examples and options regarding maps in Tableau, you can refer to the Tableau documentation provided here.

Related Articles