Home  >  Blog  >   Tableau  > 

Import Custom Geocode Data / Map in Tableau

Rating: 4.9
  
 
7205
  1. Share:
Tableau Articles

Geocode in Tableau - Table of Contents

Importing Custom Geocoding into Tableau

Tableau Desktop recognizes a set of geographic roles that can be used to automatically geocode your data and create map views. For example, Tableau Desktop recognizes country names, state/province names, city names, and area codes.

If your geographic data does not fit into the built-in geographic roles, you can create new geographic roles and assign them to the geographic fields in your data. For example, if your data contains country, state/province, and street address data, Tableau Desktop will aggregate your data to the country and state/province level, but will not recognize the street address data as a geographic role. In this case, you can create a custom geographic role for the street address data.

If you had to go through the trouble to add customized geographic coordinates, wouldn’t it be better to make it available to other people within your organization? This is done by importing the address coordinates directly into Tableau Desktop. After they are imported, the custom locations behave like Tableau’s default geographic units. The import file should have the following characteristics:

  • Give each location to record a unique identifier (key record).
  • Save the location file in comma-delimited CSV format.
  • Label the coordinate fields as Latitude and Longitude (these keywords must be used).
If you want to enrich your career and become a professional in Tableau, then enroll in "Tableau Training". This course will help you to achieve excellence in this domain.

It’s best not to include a lot of additional dimensional data in these important files. Be sure that you have only one instance of Tableau open when you perform the import. If you want to share this custom data with other people building reports in Tableau, store the list in a shared network directory so that other users can import from the same list as well. Figure 5.11 is an example of a custom geocode table properly formatted for import.

building reports in Tableau

Figure 5.11: Custom geocode table

After saving the custom list in comma-delimited CSV format, the custom geographic data can be imported into Tableau. Initiate the import using the main menu (map/ geocoding/ import custom geocoding). A small file will only require a few seconds to load. Large lists can take up to several minutes. Running the import will create a new data file on your computer within (My Tableau Repository/ Local Data). The custom data is stored as a Tableau data source file (TDS) with the same name as the source CSV file which was imported earlier.

[ Related Page - Learn How Tableau Geocodes Your Data ]

Once you have created a .csv file with custom geocoding you can import that file into Tableau. Follow the steps below to import a new geographic role.

  1. Click Map > Geocoding > Import Custom Geocoding.
  2. In the Import Custom Geocoding dialogue box, click the button to the right of the text field to browse to the folder your import file is saved in. All files in the folder will be imported into Tableau.
  3. When finished, click Import.

The custom geocoding data is imported into the workbook and the new geographic roles become available. To assign a new geographic role to a field, right-click the field in the Data pane, select Geographic Role, and then select the role you want to assign it.

Using Custom Geographic Units in a Map

After importing custom geocodes into Tableau Desktop you can use them with other data files to build maps as long as those files contain the same location key record defined in your data import table. The custom data file used in the rest of this example looks like the one in figure 5.12.

Custom Geographic Units

Figure 5.12: Warehouse location table

Notice that there is no longitude or latitude data in the table shown in Figure 5.12. However, the (Whse) field can be used to link the imported data from the custom geocode table displayed in Figure 5.11. The steps to use custom geocoding in this example are:

  • Attach Tableau to a data source.
  • Alter the geographic role of the key records (use the imported custom geography).
  • Use the key record in your view to plot the location on a map.

 MindMajix YouTube Channel

Altering the geographic role of the warehouse location is done by right-clicking on the Whse field, and selecting Geographic Role/ Whse as you see in Figure 5.13

Geographic Role/ Whse

Figure 5.13: Altering the geographic role

[ Check out Tableau Interview Questions and Answers ]

The whole field icon will change to an icon that is similar to a standard geographic icon, but with a small list in front of the globe. Tableau will now recognize the imported geographic data. Figure 5.14 shows a map plot of the custom geocoded warehouse locations.

custom geocoded

Figure 5.14: Warehouse location map

Notice that the column and row shelves are using tableau’s (generated) latitude and longitude fields. However, the warehouse marks actually use imported custom locations to place the marks. Hovering over the Los Angeles location causes a customized tooltip to appear, showing particulars about the warehouse zooming in on the Los Angeles location. In figure 5.15, you can see that the mark is more precisely placed than the tableau’s standard geocoding can provide. This detail comes from the imported geocodes you saw in figure 5.12.

The order of the steps for enabling custom geocodes, at the beginning of this section isn’t the only way to achieve the result. You can import the custom geocoding at any point-even after a map plot is done using standard geographic plotting.

Now that you’ve learned how to precisely plot any location on a map with custom geocoding, in the next section you’ll learn how to replace tableau.

enabling custom geocodes

Figure 5.15: Los Angeles warehouse

Replacing Tableau’s Standard Maps

Tableau maps visualization is special scatter plots that use map images for backgrounds and special measures (longitude and latitude) to plot marks on the map. This implies that you can replace Tableau’s standard map images with other image files.

Explore Tableau Sample Resumes! Download & Edit, Get Noticed by Top Employers!

List of Tableau Courses:

 Tableau Advanced Training
 Tableau Server Training
 Data Visualization and Dashboarding Fundamentals Training

 

Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Tableau TrainingAug 05 to Aug 20
Tableau TrainingAug 08 to Aug 23
Tableau TrainingAug 12 to Aug 27
Tableau TrainingAug 15 to Aug 30
Last updated: 04 August 2023
About Author
Remy Sharp
Saikumar

As a Senior Writer for Mindmajix, Saikumar has a great understanding of today’s data-driven environment, which includes key aspects such as Business Intelligence and data management. He manages the task of creating great content in the areas of Programming, Microsoft Power BI, Tableau, Oracle BI, Cognos, and Alteryx. Connect with him on LinkedIn and Twitter.

Recommended Courses

1 /15