Explore Data Geographically

Lesson Objectives

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

  • Describe how to use a geographical field to build a map.
  • Understand what kinds of questions maps can help you answer.

Mapping with Tableau

So far, you've built some great visualizations that allow you to analyze sales over time and by product, as well as to compare sales and profits across categories. After examining product sales and profitability in the South region, you decide to look for trends and patterns in that area.

Since you’re looking at geographic data, you have the option to build a map view. Map views are great for displaying and analyzing this kind of geographic information.

Geographic Roles

Tableau recognizes a lot of common geographic data, such as state and city names. When Tableau recognizes this type of data, it automatically assigns fields appropriate geographic roles, so they become geographic fields.

Geographic fields have globe icons Geocode indicatornext to them in the Data pane. If a field is assigned a geographic role, Tableau automatically creates a map view when you add it to the sheet. If Tableau doesn't recognize your data as geographic, you can manually assign a geographic role to each of the relevant fields as mentioned in Data Connection in Tableau Desktop.

There are many geographic roles to choose from. Here is just a sample.

  • Airport
  • Area Code
  • City
  • Congressional District
  • Country/Region
  • County
  • State/Province
  • ZIP Code/Postcode

When your data has a geographic field, several things happen.

  • The field gets added to a Marks card. In the case of a data set that has state and country in hierarchical order, both fields are added.
  • Tableau automatically creates a map visualization with Latitude and Longitude in the Columns and Rows shelves. You can think of latitude and longitude as X and Y fields. They’re essential anytime you want to create a map view, because each location in your data is assigned a latitudinal and longitudinal value. Sometimes the latitude and longitude fields are generated by Tableau. Other times, you might have to manually include them in your data. 

Build a Map View to Answer Geographic Questions

You might use a map to help answer questions such as, Which regions in the US have the highest obesity rates? Or, Which states have the most coffee shops? Or, Which states have the most sales and profits in the South region?

Look at this map view with Country and States.

Basic map view showing the US with a mark on each state

In this example, there is a mark for each of the 48 contiguous states in the US (The Superstore data set doesn’t include Alaska and Hawaii.)

Notice that the Country field is also added to the view. This happens because the geographic fields in Superstore are part of a hierarchy. Each level in the hierarchy is added as a level of detail, like layers of an onion.

Focus the Map View

Most times, a simple map view is not enough. You need to add a focus, like:

  • Region.
  • Marks to indicate value.
  • Color to differentiate between higher and lower performing areas.

This is all possible. Let’s check it out!

Build a Map View

In this simulation, you build a symbol map to show geographic distributions of data in your data set. You use your CompanyOrders dataset to create a map that shows which US states had the most sales and profit.

  1. Launch Trailhead Simulator.
  2. Ensure you’re in the Build a Map View simulation.
  3. Click Begin.
  4. In the open worksheet, drag State into the view. Tableau generates the latitude and longitude fields on Columns and Rows since the State field was geocoded. Now that you have generated a map, check which US states had the most sales.
  5. Drag Sales to Size on the Marks card.
  6. Increase the size of the circles so it’s easier to see which states had the most Sales. Click Size on the Marks card.
  7. Click the slider to get the desired size.  Notice that the size of the marks has increased. A symbol map is perfect here because the circles in the view standardize how the data is shown, and you don’t get a biased view of sales based on the relative size of the states. Instead, you are focusing on the size of each circle. It’s not a good idea to put a measure with potentially negative values on Size, because it’s not immediately clear whether a mark with a negative number is positive or negative.
  8. Click anywhere to continue.
  9. Drag Profit to Color on the Marks card.
  10. You want the marks to be more prominent by adding a border around them. Click Color on the Marks card.
  11. Next, click the Border dropdown.
  12. Select Black. This makes the circles stand out more from the gray map image. Notice that all the marks now have a distinct border around them.
  13. Click anywhere to continue. You can also adjust the background settings on your map.
  14. Click Map from the application menu, then click Background Maps.
  15. Select Normal. Notice how the view changes.
  16. Click Map again, then click Map Layers. The Map Layers pane appear on the left panel.
  17. Deselect Land Cover.
  18. Select Coastline.  You can see how the map view changes with each selection.
  19. Click Home to restart the activity or Exit to continue.

You just created a symbol map that shows which US states had the most sales and profit. You used both size and color, and applied formatting techniques. Remember that symbol maps are useful here because the circles in the view standardize how the data is shown, and you don’t get a biased view of sales based on the relative size of the states.

In this module, you learned how to create a line chart, bar chart, scatter plot, and map using Tableau Desktop. Those are just a handful of the visualizations you can build with Tableau.