I’ve been meaning to write about the maps in Tableau for some time now as I’m really impressed with how they look, how easy they are to use and how powerful they are as a visual geographic reporting tool.

If you have geographic data, preferably with a longitude and latitude, you can display mapped data in a matter of minutes. Tableau maps allows zooming in and out, however this isn’t as user friendly as Google maps.

Depending on the Geographic Breakdown Structure (GBS) used it’s also possible to select the different levels of geography (i.e. country, state, city, etc) to display the data using the average of the longitudes and latitudes in each geography.

The example I’m using here is showing properties available for rent and/or sale on a well known website. Their GBS structure allows me to use parameters for the user to view the data at different levels of the GBS structure. For the example I’m displaying the following GBS levels:

  • Country/State – the US is state level, the rest of the world at country level
  • Region/State – depending on the country this can differ
  • Region – this is the very bottom of the GBS, it’s the most granular level of property location data we have

It’s only a small number of steps to create the map.

Check the geographic data to create the map

The data behind the report is very simple, it contains the Latitude and Longitude of each region. This is the most granular location for each property. Also, for each region, it contains the Country, State and listings count.

This is a small sample of the data:

 

CountryNameStateNameRegionLatLongListings
AlabamaAlabama Gulf CoastMobile30.4543-88.13149
AlabamaAlabama MountainsFort Payne34.32809-85.71769
AlabamaAlabama MountainsWilson Lake34.76984-87.41659
AlabamaMetropolitan AlabamaLay Lake33.18677-86.51419
AlabamaMetropolitan AlabamaLogan Martin Lake33.49711-86.22449
AlabamaRiver Heritage AlabamaLake Jordan32.64119-86.26469
AlabamaRiver Heritage AlabamaMontgomery32.34241-86.03059
AlabamaAlabama Gulf CoastJosephine30.3224-87.517510
AlabamaAlabama MountainsFlorence34.82954-87.573610
AlabamaAlabama MountainsMentone34.58446-85.589710
AlabamaAlabama MountainsMuscle Shoals34.79944-87.570115
AlabamaAlabama Gulf CoastFoley30.34198-87.662119
AlabamaMetropolitan AlabamaWedowee33.32353-85.598227
AlabamaAlabama MountainsWeiss Lake34.13304-85.669528
AlabamaAlabama MountainsLewis Smith Lake34.05801-87.106446
AlabamaMetropolitan AlabamaTuscaloosa33.31168-87.560146
AlabamaRiver Heritage AlabamaLake Martin32.7671-85.859455
AlabamaAlabama Gulf CoastFairhope30.50429-87.910463
AlabamaAlabama Gulf CoastOno Island Orange Beach30.57985-87.4263
AlabamaAlabama MountainsGuntersville Lake34.43801-86.243599
AlabamaAlabama Gulf CoastDauphin Island30.25082-88.1252191
AlabamaAlabama Gulf CoastFort Morgan30.23378-87.9155769
AlabamaAlabama Gulf CoastOrange Beach30.27351-87.58491,483
AlabamaAlabama Gulf CoastGulf Shores30.24537-87.75343,110
AlaskaBig LakeBig Lake61.52685-149.8699
AlaskaDenaliDenali63.22011-147.6919

Load this data into Tableau and you will notice the Latitude, Longitude and Listings fields will be in the Measures section.

Building the Tableau map

To create the map, hold the ctrl key and click on the 3 fields, selecting them all. Next click Show Me! in the toolbar. The Map chart type should highlight automatically.

Clicking OK should create the map. However, because it’s showing the Avg of the longitudes and latitudes I expect the data will appear as one large blob in the middle of the screen. 

To split the blob place one of the GBS levels on the Detail shelf.

Adding the Country on the Detail shelf makes this look more like a map. Now a blue blob will appear in each country. Similarly if State is on the Detail shelf there will be a blue mark in each State.

In the example the user is able to choose which level of the GBS they want to see. This is by using a parameter, which enables the user to select the level, and a calculated field which uses the result of the selection, thereby displaying the selected GBS level. This is covered in previous post about how a user can display what they select in a report.

Once the parameter and calculated field are created, to finish put the new calculated field to the LOD shelf,  replacing CountryName. Now the core of the map view are complete. All that remains is to tidy it up; the titles, tooltips, etc.