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 – although this isn’t the most user friendly when compared to the likes of 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 US website with subsidiaries in Australia and Brazil. 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 deepest level we have as to where the property is located

A map report like this can be created in a small number of steps. The data behind the report is very simple, it contains the Latitude and Longitude of each region (the most granular location for each property) with the regions’ country/state and the count of listings in each location.

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

Once this data is loaded into Tableau the Lat, Long and Listings fields will be in the Measures section. To create the map holding down the ctrl key click on the 3 fields so they are all highlighted  then click Show Me! in the toolbar. The Map chart type should be automatically selected.

Clicking OK should display one large blue blob in the middle of the screen. This is because all of the longitudes and latitudes are being averaged, and aren’t being displayed individually.

To break them out one of the GBS levels needs to be in the Level Of Detail (LOD) shelf.

This will now make the map look more like a map – now a blue blob will appear in each country.

In the example I have allowed the user to choose which level of the GBS they want to see. This is done by using a parameter from which the user selects and a calculated field which uses the result of the parameter selection to return to desired GBS level. In a previous post about how a user can display what they select in a report I have given a description of how to do this.

Once the parameter and calculated field are created the next step is to put the calculated field into the LOD shelf in place of CountryName and the bones of the report are now complete, all that remains to do is to tidy up the titles, tooltips, etc.