How Does Tableau Generate Latitude and Longitude?
Ever drag a field like "City" or "State" onto a Tableau worksheet and watch in awe as a map magically appears? It’s one of Tableau's most impressive features, but how does it actually know where to place "Paris" or "Tokyo" on the globe? The answer is a powerful built-in process called geocoding. This article will break down exactly how Tableau generates latitude and longitude coordinates and how you can manage the process to create accurate, insightful maps.
What is Geocoding, and Why Is It So Important for Maps?
At its core, geocoding is the process of converting textual location data - like a street address, city name, or postal code - into geographic coordinates (latitude and longitude). Latitude lines run horizontally around the Earth, measuring distance north or south of the equator, while longitude lines run vertically, measuring distance east or west of the prime meridian. These two values create a precise point on the globe.
Without geocoding, creating a map would be a painful, manual process. You'd need a dataset that already includes precise latitude and longitude coordinates for every single location you want to plot. Thankfully, Tableau handles the heavy lifting for us through its own internal location database.
Tableau recognizes a variety of common geographic roles you can assign to your data fields, including:
- Airport (ICAO code)
- Area Code
- City
- Country/Region
- County
- State/Province
- ZIP Code/Postcode
When you tell Tableau that your "State Proj" field actually represents States, it knows to look for location names like "California" or "New York" and plot them accordingly.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
How Tableau Generates Latitude and Longitude Automatically
The secret behind Tableau's mapping magic is its built-in geocoding database. This database, which comes packaged with Tableau Desktop, contains a massive, curated list of known places around the world and their corresponding latitude and longitude coordinates.
Here’s what happens behind the scenes when you create a map:
- You Assign a Geographic Role: In the Data pane, you right-click a field (e.g., a list of city names called "Customer City") and assign it the geographic role of "City." You'll see the data type icon next to your field change to a small globe, signaling to Tableau that this field contains location data.
- Tableau Scans Your Data: Tableau then reads through all the values in your "Customer City" field. For each city name, like "London," "Sydney," or "Chicago," it searches its internal geocoding database for a match.
- Latitude and Longitude are Generated: When Tableau finds a match, it retrieves the associated latitude and longitude from its database. It then creates two new, temporary fields in your workbook: Latitude (generated) and Longitude (generated). You can find these new fields, typically shown in italics, in the Measures section of your Data pane.
- The Map is Plotted: When you drag your "Customer City" field onto the canvas, Tableau automatically places Longitude (generated) on the Columns shelf and Latitude (generated) on the Rows shelf. This action plots a point for each recognized city, creating an instant map visualization.
This automated process is what makes building maps in Tableau feel so seamless. You provide the "what" (the city names), and Tableau provides the "where" (the coordinates).
Step-by-Step Guide: Creating a Map with Generated Coordinates
Let's walk through a practical example. Imagine you have a simple spreadsheet of customer sales by city.
Dataset example:
City,Sales Seattle,5500 Miami,3200 Denver,4100 Portland,2800
Step 1: Connect to Your Data
Open Tableau and connect to your data source, whether it's an Excel file, a Google Sheet, or a database.
Step 2: Assign the Geographic Role
Once your data is loaded, look for your geographic field in the Data pane on the left. In our example, this is the "City" field. You'll notice it has an "Abc" icon to its left, indicating it's currently a string data type.
Right-click the "City" field, navigate to Geographic Role, and select City from the list.
The icon will change to a globe. At this moment, Tableau is preparing to geocode your data.
Step 3: Spot the Generated Fields
Now, look at your Measures pane below the list of Dimensions. Two new fields have appeared: Latitude (generated) and Longitude (generated). These are the coordinates Tableau has pulled from its internal database based on your city names.
Step 4: Build Your Map!
Building the map is the easy part. Simply double-click your "City" field. Tableau will automatically add the generated latitude and longitude to the Rows and Columns shelves and plot your cities on a world map.
To make the map more useful, you can drag your "Sales" measure onto the Size mark to make the dot for each city bigger based on its sales volume. You're now analyzing geographic data without ever needing to look up a coordinate.
Handling Unrecognized and Ambiguous Locations
Tableau's geocoding is powerful, but it's not foolproof. You will almost certainly encounter situations where some of your locations don't map correctly. When this happens, a small indicator will appear in the bottom-right corner of your map telling you there are "unknown" locations.
Here are the common reasons and how to fix them:
1. Misspellings or Non-Standard Names
A simple typo like "Chcago" instead of "Chicago" will cause Tableau to not find a match. Similarly, a very local or non-standard name might not be in its database.
- Solution 1: Fix it in Tableau. Click the "X unknown" indicator in the bottom right corner. This opens the "Edit Locations" dialog box. Here, you can manually match your unrecognized value to a known location or enter the exact latitude and longitude yourself.
- Solution 2: Fix it at the Source. The best long-term solution is to clean your source data. Correcting the spelling in your original spreadsheet or database ensures the data is accurate for any future analysis.
2. Ambiguous Locations
What happens when you plot a city named "Springfield"? There's a Springfield in Illinois, Massachusetts, Missouri, and dozens of other places. Tableau doesn't know which one to pick, so it may pick one arbitrarily or leave it as unknown.
- Solution: Add More Geographic Detail. The fix for ambiguity is to provide more context. If your dataset also contains a "State" and "Country" field, bringing them into your analysis resolves the issue. First, assign them the proper geographic roles. Then, drag the "State" field onto the Detail mark on the Marks card. Tableau will now look for a city named "Springfield" within a specific state, giving it enough information to plot the point accurately. Creating a geographic hierarchy (Country > State > City) is a best practice for reliable maps.
What If My Locations Are Not in Tableau? Using Custom Geocoding
Sometimes your locations are ones Tableau would never know about, such as:
- Specific store addresses
- Sales territories
- Warehouse facilities
- Proprietary distribution centers
In this case, you can extend Tableau's built-in capabilities by importing your own custom geocoding. The process involves creating a CSV file with columns for your custom locations and their exact latitude and longitude.
The file structure might look like this:
Location Name,Latitude,Longitude Main Street Warehouse,47.6062,-122.3321 Downtown Kiosk,40.7128,-74.0060
You can then import this file into Tableau via the menu: Map > Geocoding > Import Custom Geocoding. Once imported, you can assign this new custom geographic role to your project-specific location field, and Tableau will plot it just like any built-in location.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
The Best-Case Scenario: Using Your Own Latitude and Longitude Fields
The most precise and error-free way to create maps in Tableau is to use latitude and longitude fields directly from your data source. Many business systems and data collection tools, especially those that deal with logistics or GPS tracking, already capture these coordinates.
If your dataset includes columns named "Latitude" and "Longitude," you can bypass Tableau's entire generated geocoding process.
- Assign Geographic Roles: In the Data pane, find your latitude field. Right-click it, go to Geographic Role, and select Latitude. Do the same for your longitude field, giving it the Longitude role. The icons will change to globes with horizontal (latitude) or vertical (longitude) lines.
- Build the Map: Drag your Latitude field to the Rows shelf and your Longitude field to the Columns shelf. Initially, you'll see a single mark on the map representing the average of all your coordinates.
- Add Detail: To see all your individual points, drag a unique identifier field (like "Store ID" or "Customer Name") onto the Detail mark. This tells Tableau to plot a mark for each individual ID in your dataset.
Using your own coordinates eliminates any ambiguity and gives you complete control over where your data points appear on the map.
Final Thoughts
That seemingly simple act of dragging and dropping a location field to create a map in Tableau is backed by a sophisticated process. Tableau's built-in geocoding service works by matching place names in your data to a vast internal database, automatically generating the Latitude (generated) and Longitude (generated) fields needed to plot your data spatially. While this process is incredibly efficient, understanding how to resolve ambiguities, handle unknown locations, and even extend Tableau with custom geocoding will elevate your mapping skills and the accuracy of your visualizations.
Learning how to create reports and dashboards across a dozen different platforms can feel like a full-time job in itself, demanding serious time to master tools like Tableau. We built Graphed because we knew there had to be an easier way for teams to get answers from their data. Instead of learning complex interfaces, you can simply connect your data sources and describe the dashboard you need in plain English - whether you're looking for map-based sales performance or a time-series line chart - and get back to making decisions instead of wrangling data.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.