Tableau Maps are a convenient way to visualize geographical data. Your data source must contain the location data (location names, latitude, and longitude coordinates) to build a simple map. If your data source does not contain the location data, below are the ways you can connect to location data:
- If Tableau recognizes your location data and automatically assigns geographic roles to your fields, then you are ready to build a map view. Just double-click one of those geographic fields, and you have a map.
- If Tableau does not immediately recognize your location data and cannot build a map view, you will need to assign geographic roles to your fields. A geographic role associates each value in the field with a latitude and longitude value. When you assign a geographic role to the field, Tableau assigns latitude and longitude values to each location based on data already built into the Tableau map server.
How to assign the geographic role to a field?
Assigning a geographic role to a field based on the type of location (like state versus postcode) helps to ensure that your data is plotted correctly on your map view. For instance, you can assign the City geographic role to a field that contains a list of city names.
When a field is assigned the geographic role, Tableau creates a map view when you add the field to the field Detail on the Marks card. In other words, Tableau maps geocodes that information in the field.
To assign a geographic role to the field, click the data type icon next to the field in the Data pane, select Geographic Role, and select the geographic role you want to assign to the field.
Tableau adds two fields to the Data pane’s Measures area when you assign a geographic role to a field: Latitude (generated) and Longitude (generated).
These fields contain the values of latitude and longitude and are assigned the Latitude and Longitude geographic roles. If you double-click on each of these fields, Tableau will add them to the Columns and Rows shelves and creates a map view using the Tableau background map.
Now see the below steps to create a simple map. For this, open Tableau Desktop and connect to the Sample-Superstore data source, which comes with Tableau.
How to build a simple point map?
Step 1: Navigate to a worksheet.
Step 2: In the Data pane, under the Dimensions, double-click on State.
A map view gets automatically created because the State field is a geographic field.
Step 3: From the Measures, drag the field Sales to Size on the Marks card. The data points on the map get updated to show the sales amount proportionally.
Step 4: Select Maps > Map Layers. In the pane Map Layers, do the following:
- Click the Style drop-down and select Normal.
- Under Map Layers, clear Country/Region Names.
- The background map updates with the new settings.
How to build a simple filled (polygon) map?
Step 1: Navigate to a new worksheet.
Step 2: In the Data pane, under Dimensions, double-click State.
A map view is automatically created.
Step 3: On the Marks card, click the drop-down Mark Type and select Map.
The map view will update to a filled (polygon) map.
Step 4: From the Dimensions, drag field Sales to Color on the Marks card.
The polygons on the map will update to show the sales amount using color.
How to select a Tableau background map style?
When you connect to the Tableau background map, you can choose any of the six built-in background map styles named Normal, Light, Dark, Streets, Outdoors, and Satellite.
To select a Tableau background map style:
Select Map > Map Layers. Click the Style drop-down menu in the Map Layers pane on the left-hand side of the workspace (under Background), and then select a background map style.
How to import your own background map?
If the built-in Tableau background map styles do not meet your requirement, you can import your own background map from Web Map Service (WMS) server or from a Mapbox map.
To import your own background map:
Step 1: Select Map > Background Maps > Map Services. Click Add in the Map Services dialog box, and then select to add WMS servers or Mapbox maps.
Step 2: Follow the prompts to connect Tableau to the map service of your choice. When finished, click Close.
Step 3: Select Map > Background Maps and select the background map you want to use.
The map will update to include the background map you choose.
How to show or hide map layers?
If you are using either the Tableau background map or a WMS map or Mapbox map that contains custom layers, you can also show or hide layers on your background map for customizing the background elements that frame your geospatial data. For instance, you can overlay streets and highways or county boundaries on the map to give your data context.
Step 1: Select Map > Map Layers. Select one or multiple map layers in the Map Layers pane, under the Map Layers section.
Step 2: To use layers that are not available, zoom further into the view.
How to add color in your map?
There are two ways for adding color to your map view: You can either color locations categorically, or you can color locations quantitatively.
To color locations on your map categorically, drag a dimension to Color on the Marks card from the Data pane. The image below shows each state in the U.S. colored by a region: West, Central, East, and South.
To color each location on the map quantitatively, drag a measure to Color on the Marks card from the Data pane.
The image below shows each state in the U.S. colored by the sales amount, they have achieved.
How to add labels on your map?
You can also add labels to your locations to provide extra context. For instance, you can add labels for location name and sales.
For adding labels to your data, drag a dimension or measure to Label on the Marks card from the Data pane.
A label will appear in the center of your location (if it is a polygon), or to the side of your location (if it is a data point). You can also add multiple labels.
How to adjust the size of your data points?
You can adjust your data points’ size to compare and contrast them or to make smaller data points easier to see.
For uniformly adjusting the size of your data points, Click Size on the Marks card, and then adjust the slider either to the left or right.
To size, your data points quantitatively, drag a Size field on the Marks card from Measures.