This article explains the basic concepts of map views, and demonstrates how you can create a map view in Tableau.
Tableau automatically assigns geographic roles to fields with common geographical names, such as Country, State/Province, City, etc. Fields with a geographic role will automatically generate longitude and latitude coordinates on a map view. Geographic roles can also be manually assigned to fields that are not automatically recognized. Fields with assigned geographic roles will have a globe icon next to them.
Steps to Reproduce:
Let’s use the sample file, Sample – Superstore Sales (Excel). Open a new worksheet and select Sample – Superstore Sales (Excel) as the data source.
Once the data is loaded, perform the following steps to create a map with markers encoding information of a measure:
Go to the URL: http://www.gadm.org/country and Select country as “INDIA” and File Format as “Shapefile” and click OK.
(You can also download India_Geo codes.xsl or Ind_adm2_Points.csv (Download links Present at the bottom of the Page))
Open a new workbook by clicking on New under the File menu. Click on Connect to Data to select the data file. Under the In a file options, click on Excel File.
Select India_Geo codes.xsl/ Ind_adm2_Points.csv from your downloaded file’s location and hit Open. Maintain all the default options and hit OK.
Double-click on the State field in the Data window. Tableau automatically creates a geographic visualization using the Latitude (generated), Longitude (generated), and State fields. Based on the fields and shelves you have used, Tableau has switched the automatic mark type to filled maps. You can see that there is something wrong with the Map because few states are not shown like Jharkhand, Uttar Pradesh etc. This often happens because your data values may be spelled incorrectly or use an abbreviation that Tableau does not recognize.
When this happens those values are marked as unknown in the lower right corner of the view .In the lower right area of the map, there is a gray pill that includes the text (5 unknown). This indicates that five geographic records are missing or unrecognized in the data set.
Clicking on the pill opens the special values menu that provides three options for dealing with the unknown record:
- Editing the locations (to correct the error)
- Filtering the data (to exclude the record)
- Showing the data at the default position (this means zero)
Clicking the edit location option exposes the special values menu you see in the upper left area
When this happens, you can edit the unknown location names to map to known locations. This ability to quickly identify and correct non-conforming records will save your time.
Tableau provides quite a few options to change the format of a generated map. Some of the options include washout, to make the map transparent, and removing borders. By customizing maps this way, we improve the readability as well as increase the efficacy of the maps.
- Uncheck the box in front of Base to make the map look more clean and aesthetically pleasing.
- Uncheck the box in front of Light State Border & Names to make the map look even cleaner, since the map is already grouping the states.
- Drag the Washout slider to 100 percent if you want to see only the filled map with no other additional information.
How Mapping works.
Once we loaded the data, Tableau assigned geographic roles to State, City, and Customer Zip Code using field names. Tableau also generated Latitude and Longitude for these geographic roles. When we clicked on the symbol of maps, Tableau automatically added State to the Level of Detail pane and placed marks for every state that was present in the data. If you add Customer Zip Code to the Detail box, Tableau will generate markers by zip code and adjust the mark size for the respective Measure say Profit value of that zip code.
Tableau provides these powerful features using various data providers listed on Tableau’s website: http://www.tableausoftware.com/mapdata
If these maps do not meet your needs, Tableau also has the option of using an open technology called Web Map Services (WMS) to get the map source. You can read about using a WMS server at http://onlinehelp.tableausoftware.com/current/pro/online/enus/maps_mapsources_wms.html.