Tableau does a good job of mapping many types of geographic data. Users are just a drag and drop away from creating maps using common geographic data such as country/provinces, city, and zip codes. When connecting to a data source, Tableau recognizes this data and assigns a geographic role creating latitude and longitude values for each data point that allow it to visually display the data. Dragging a field to Detail on the Marks card creates the appropriate map view.
But what happens when you are working with geographic data that Tableau does not automatically recognize? Perhaps you need to map individual store locations, school districts, or smaller towns not included in Tableau’s current geographic role hierarchy. This is when custom geocoding options step in. There are several options you can use to get Tableau to recognize unassigned geographic data. This blog will cover one of these options; creating a new geographic role. In this example, we will map specific store locations using street addresses.
Create a .csv File with your New Geographic Data
To create a new geographic role you must tell Tableau two things: 1) the latitude and longitude for each location you want to map and 2) which built-in geographic hierarchy you will add this new role to. The first column of the file must contain the location names of the new geographic role. The column header will become the name of the geographic role.
Note: The column headers must be “Latitude” and “Longitude”. Abbreviations or misspellings will not work.
The next columns must be from the existing Tableau hierarchy such as Country (Name) > State/Province or Country (Name) > Zipcode/Postcode.
Note: The column headers must be exact names used in the hierarchy. “Country (Name)” is correct “Country” alone will not be recognized.
Save the .csv file alone in a folder. When you connect to this folder Tableau will upload its entire contents.
Import File into Tableau
Open Tableau, connect to a data source and navigate to a sheet. I am using an Excel file with financial data for each store listed in the .csv created in the above step.
Go to and click on Map. Scroll down to Geocoding > Import Custom Geocoding.
After clicking on Import Custom Geocoding, a pop-up window will appear. Navigate to the folder where you saved the .csv and click on Import. The import process may take a few minutes depending on the size of the .csv.
Assign New Geographic Role
Navigate to the field you want to assign the newly created role to. In this case Store. Notice that Store is marked as a string dimension. Click on the down arrow and scroll to Geographic Role > Store.
Once you click Store, the geographic role has been added to the Store dimension.
Note: Notice the “ABC” icon next to the Store dimension has changed to a globe marking the field as a geographic role.
Build the Visualization
Drag the field to the Details mark card. The appropriate map with each location marked as a circle should appear. Add measures, filters, etc to build your desired visualization.
Custom geocoding and creating new geographic roles expands Tableau’s built-in geographic roles and hierarchies. This method opens the possibility of building powerful visualizations using custom location data.
Do you have more questions about Tableau? Talk to our expert consultants today and have all your questions answered!
No. Since this method requires matching each data point with one latitude and longitude measure, creating filled maps isn’t possible. One option would be to use shapefiles instead of longitude and latitude fields.
No. The geographic role is now available in any Tableau workbook created on the computer used to create the role.