Tableau • Mapping and Spatial

Custom Geocoding — Use custom geocoding and resolve unknown locations

Extend Tableau's built-in geographic dictionary so every row in your dataset lands on the map.

Tableau illustration with a dashboard presentation, data visualization, and database
Inside this lesson 10 sections 5 questions 6 figures

SECTION 1

Historical Context & Motivation

The ability to place data on a map has been a cornerstone of business intelligence since the earliest days of geographic information systems. When Tableau first introduced mapping capabilities, it relied on an internal geocoding dictionary — a lookup table that translates place names such as country, state, city, and ZIP code into latitude–longitude pairs. This built-in dictionary works beautifully for well-known administrative boundaries, but the real world is messy: organizations track data by sales territories, warehouse codes, campus buildings, custom regions, or proprietary location identifiers that no commercial geocoding service recognizes. The gap between what Tableau knows and what your data contains is precisely the problem that custom geocoding solves.

2003 • Tableau's First Maps

Tableau 1.0 ships with a modest built-in geocoding dictionary covering countries, U.S. states, and ZIP codes, enabling drag-and-drop mapping for common geographic hierarchies.

2008–2010 • Early Custom Geocoding Capabilities

Tableau introduced mechanisms for users to supply custom location data in earlier versions, with the feature set evolving gradually across releases. The ability to extend the internal geocoding dictionary developed incrementally rather than appearing as a single wholesale feature in any one release.

2015 • Mapbox Integration

Tableau 9.2 adds support for custom Mapbox map styles and WMS servers, enriching the spatial layer ecosystem and motivating richer custom geocoding workflows for non-standard geographies.

2020 • Spatial File & Calculation Support

Tableau 2020.x deepens spatial support with MAKEPOINT, MAKELINE, and native joins to shapefiles, but custom geocoding remains the go-to approach when your data uses categorical location identifiers rather than raw coordinates.

2024 • Modern Hybrid Workflows

Current Tableau versions support blending custom geocoding with spatial calculations and live map layers, giving analysts a full pipeline from unknown location strings to rich, interactive cartographic visualizations.

The central question custom geocoding addresses is deceptively simple: How do you map a location that Tableau does not recognize? Whether the unrecognized location is a misspelled city, a proprietary store code, or an entirely novel geographic concept like a delivery zone, the answer follows the same pattern — supply Tableau with a mapping from your identifier to a latitude–longitude pair, and it will plot the point on the canvas.

SECTION 2

Core Principles & Definitions

Before diving into implementation, it helps to formalize the concepts that underpin custom geocoding in Tableau. Every map visualization depends on a geocoding role — a semantic tag that tells Tableau a field represents a geographic entity. When the built-in dictionary cannot match a value, Tableau flags it as an unknown location, and the row disappears from the map. Custom geocoding is the systematic process of resolving these unknowns by extending or overriding Tableau's internal dictionary.

1

Geographic Role

A metadata annotation on a field indicating its geographic semantics (e.g., City, State, ZIP Code). Tableau uses this role to look up coordinates in its internal dictionary. You can assign roles manually via the field's context menu.
2

Unknown Location Indicator

A small gray icon (⚠) that appears in the lower-right corner of a map view when one or more values could not be geocoded. Clicking it reveals the exact unmatched values and offers options to edit locations or filter them out.
3

Custom Geocoding CSV

A structured CSV file containing columns for each level of your geographic hierarchy plus Latitude and Longitude. Importing this file into Tableau extends the internal dictionary so that your custom identifiers resolve to map coordinates.
4

Edit Locations Dialog

An interactive UI in Tableau that lets you manually match unknown values to recognized locations, set a fixed latitude/longitude, or exclude values. Useful for one-off corrections without a full CSV workflow.
5

MAKEPOINT Spatial Calculation

A Tableau calculated field function — MAKEPOINT(lat, lon) — that creates a spatial object from numeric latitude and longitude columns. An alternative to custom geocoding when your data already contains coordinates but lacks recognized place names.
✦

KEY TAKEAWAY

Think of Tableau's built-in geocoding dictionary as a phone book that only lists major cities. Custom geocoding is like adding your own entries — your neighborhood pizza shop, your friend's unlisted cabin — so the directory can find them too. Without those entries, calls to unknown numbers simply fail; with them, every number resolves to an address.

SECTION 3

Visual Explanation — The Custom Geocoding Pipeline

Custom Geocoding PipelineYour DataStoreID, Region,Sales, ...Tableau GeocoderBuilt-in Dictionary+ Custom CSV✓ MatchedPlotted on map⚠ UnknownMissing from mapThree Resolution StrategiesA. Edit LocationsManual UI fixMatch to known placeor enter lat/lonBest for: ≤10 fixesB. Custom CSVImport geocoding fileMap → Geocoding →Import Custom GeocodingBest for: 10–10,000+C. MAKEPOINT()Use lat/lon columnsdirectly in a calcBypasses dictionaryBest for: raw coords✓ All locations resolved → Complete map visualization
The pipeline shows how data flows from your source through Tableau's geocoder. Matched values appear on the map; unknown values trigger the warning indicator. Three strategies — Edit Locations, Custom CSV import, and MAKEPOINT() — resolve the unknowns depending on scale and data characteristics.

The diagram above captures the complete decision flow. Your data enters Tableau with string-valued location fields. Tableau attempts a dictionary lookup, and values that resolve are immediately plotted. Values that fail appear as unknown locations. At that point you choose a resolution strategy: the interactive Edit Locations dialog for a handful of corrections, a custom geocoding CSV for batch or recurring scenarios, or the MAKEPOINT() function when your data already includes numeric coordinates. In practice, the CSV approach is the most scalable and reproducible, making it the preferred solution for enterprise analytics pipelines.

SECTION 4

How Custom Geocoding Works Under the Hood

Custom geocoding in Tableau is conceptually a key–value join. The key is a composite of every geographic hierarchy level you provide (e.g., Country + State + City), and the value is the (latitude, longitude) pair. When you import a custom geocoding CSV, Tableau merges its contents into the internal dictionary using a left-join-like strategy: if a key already exists, your values override the built-in ones; if the key is new, it is appended. Understanding this join semantics is essential for debugging situations where locations map to the wrong point.

CSV Schema Requirements

The custom geocoding CSV must follow a strict schema. Each row represents one geocodable entity, and the columns define the hierarchy. The two mandatory columns are Latitude and Longitude (decimal degrees, WGS 84). The remaining columns must use Tableau-recognized header names that correspond to geographic roles: Country, State, County, City, Zip Code, or your own custom string that will create a new role. Parent hierarchy columns are optional but strongly recommended to disambiguate locations that share names.

Column NameRequired?Data TypeExample Value
CountryRecommendedStringUnited States
StateRecommendedStringCalifornia
CityAt least one identifierStringCupertino
LatitudeYesFloat (decimal degrees)37.3230
LongitudeYesFloat (decimal degrees)-122.0322

Custom geocoding CSV column requirements

Coordinate Reference System

Tableau's mapping engine assumes coordinates in the WGS 84 (EPSG:4326) coordinate reference system, the same system used by GPS. Latitude values range from −90 to 90, and longitude values range from −180 to 180. If your source data uses a projected CRS (e.g., UTM or State Plane), you must reproject the coordinates before importing them into Tableau. Tools like pyproj in Python or PostGIS's ST_Transform make this conversion straightforward.

HAVERSINE DISTANCE (OPTIONAL VALIDATION)

d=2R×arcsin(√(sin2((φ2−φ1)/2)+cos(φ1)×cos(φ2)×sin2((λ2−λ1)/2)))d = 2R × arcsin(√(sin²((φ₂ − φ₁)/2) + cos(φ₁) × cos(φ₂) × sin²((λ₂ − λ₁)/2)))

Where R ≈ 6,371 km (Earth's mean radius), φ = latitude in radians, λ = longitude in radians. Useful for sanity-checking that custom-geocoded points are within a plausible distance of their expected locations.

SECTION 5

Detailed Breakdown — Building the Custom Geocoding CSV

Constructing a correct custom geocoding CSV requires attention to hierarchy, naming conventions, and encoding. This section walks through the file structure and common pitfalls that trip up even experienced Tableau users.

Custom Geocoding CSV — Example File LayoutCountryStateCityStore CodeLatitudeLongitudeUnited StatesCaliforniaSan JoseSJ-00137.3382-121.8863United StatesCaliforniaSan JoseSJ-00237.3541-121.9552United StatesTexasAustinATX-01030.2672-97.7431CanadaOntarioTorontoTOR-00543.6532-79.3832Key Rules for the CSVUse UTF-8 encoding — avoid BOM markers that Tableau may misread.Column headers must match Tableau's geographic role names exactly (case-insensitive).Include parent hierarchy columns (Country, State) to prevent ambiguity for common city names.Latitude/Longitude must be in decimal degrees (WGS 84). No DMS notation.Custom columns (e.g., "Store Code") create new geographic roles automatically upon import.⚠ Tip: After import, verify the new role appears in the Geographic Role menu for the relevant field.Map → Geocoding → Import Custom Geocoding... → select your .csv file
The CSV layout uses standard Tableau geographic role names as column headers. The Store Code column (highlighted in cyan) is a custom identifier that creates a new geographic role upon import. Parent columns like Country and State disambiguate locations that share names across regions.

Common Pitfalls

  • Encoding issues: Saving a CSV from Excel on Windows may insert a UTF-8 BOM (byte order mark). Some Tableau versions silently misparse the first column header. Use a text editor or pandas.to_csv(encoding='utf-8-sig') to control the output.
  • Ambiguous names: "Springfield" exists in over 30 U.S. states. Without a State column, Tableau will resolve it to an arbitrary match or fail entirely.
  • Swapped lat/lon: A surprisingly common error. If your points appear in the ocean or in a mirror-image location, verify the column order.
  • Stale cache: Tableau caches geocoding results. After updating your CSV, you may need to clear the geocoding cache via Map → Geocoding → Remove Custom Geocoding, then re-import.

SECTION 6

Worked Example — Mapping Company Warehouses

Suppose you work at a logistics company with 4 regional warehouses identified by internal codes (WH-EAST, WH-WEST, WH-CENTRAL, WH-SOUTH). Your sales dataset references these codes, but Tableau's built-in geocoder has no idea what "WH-EAST" means. Let us walk through the full resolution workflow using a custom geocoding CSV.

Resolving Custom Warehouse Codes via Custom Geocoding

  1. 1

    Step 1 — Identify the Unknown Locations

    Drag the Warehouse field onto the map shelf. Tableau displays an empty map and shows the ⚠ unknown location indicator in the lower-right corner. Click it to reveal all four codes: WH-EAST, WH-WEST, WH-CENTRAL, WH-SOUTH.
    Four unknown values identified.
  2. 2

    Step 2 — Obtain Coordinates

    Look up the GPS coordinates for each warehouse. You can use Google Maps (right-click → "What's here?"), a geocoding API such as the Google Geocoding API or Nominatim, or an internal facility database. Record the values in decimal degrees.
    WH-EAST → (40.7128, −74.0060); WH-WEST → (34.0522, −118.2437); WH-CENTRAL → (41.8781, −87.6298); WH-SOUTH → (29.7604, −95.3698).
  3. 3

    Step 3 — Build the Custom Geocoding CSV

    Create a CSV file with three columns: Warehouse, Latitude, and Longitude. Save it as warehouse_geocoding.csv with UTF-8 encoding. Each row contains one warehouse code and its coordinate pair.
    CSV file with 4 data rows and a header row ready for import.
  4. 4

    Step 4 — Import into Tableau

    In Tableau Desktop, navigate to Map → Geocoding → Import Custom Geocoding… and select the folder containing your CSV. Tableau scans the file, recognizes the Latitude and Longitude columns, and creates a new geographic role called "Warehouse" based on the custom column name.
    New geographic role "Warehouse" added to the geocoding dictionary.
  5. 5

    Step 5 — Assign the Geographic Role and Verify

    Right-click the Warehouse field in the data pane, choose Geographic Role → Warehouse. Now drag it onto the map shelf again. All four warehouses appear at the correct U.S. locations. The ⚠ indicator is gone, confirming complete resolution.
    All four warehouse locations are plotted correctly on the map.
💡

Pro Tip

If you plan to share the workbook via Tableau Server or Tableau Public, the custom geocoding data is embedded in the workbook file. However, if a colleague opens the workbook in Desktop without the same custom geocoding folder imported, they will see unknown locations again. Document your geocoding files alongside your workbook for reproducibility.

SECTION 7

Strengths, Limitations & Method Comparison

Custom geocoding is not the only way to place non-standard locations on a Tableau map. Understanding when to use each approach prevents over-engineering and ensures long-term maintainability.

CriterionEdit Locations (Manual)Custom Geocoding CSVMAKEPOINT() Calculation
Scale1–10 fixes10–10,000+ entriesUnlimited (data-driven)
ReproducibilityLow — stored in workbook, not version-controlledHigh — CSV can live in source controlHigh — coordinates come from the data source
Requires coordinates?No (can match to known place)Yes (lat/lon in CSV)Yes (lat/lon in data)
Creates geographic role?NoYes (custom role)No (creates spatial object)
Works with hierarchies?LimitedFull multi-level hierarchyNo hierarchy — flat points only
Best use caseQuick one-off corrections (typos, aliases)Custom territories, store codes, campus buildingsIoT sensor data, GPS logs, any dataset with embedded coordinates

Comparison of location resolution methods in Tableau

✦

KEY TAKEAWAY

Think of these three methods as tools on a spectrum of automation. Edit Locations is like manually correcting typos in a document — fine for a handful. A custom geocoding CSV is like building a spell-check dictionary for your domain — scalable and reusable. MAKEPOINT() is like auto-translating the entire document in real time — powerful when the translation data is already embedded. Choose the simplest tool that fits your data's characteristics.

SECTION 8

Connection to Advanced Spatial Analysis

Custom geocoding is the entry point to a much richer spatial analytics stack in Tableau. Once your locations resolve correctly, you unlock capabilities like spatial joins, buffer calculations, and density heatmaps that would be impossible with unresolved locations. The table below maps custom geocoding concepts to their advanced counterparts, providing a roadmap for deeper exploration.

Custom Geocoding ConceptAdvanced ExtensionDescription
Point locations (lat/lon)MAKEPOINT + Spatial JoinJoin custom-geocoded points to polygon shapefiles (e.g., which sales territory does each store fall in?) using Tableau's native spatial join.
Custom hierarchy (Country → Store)Level-of-Detail (LOD) ExpressionsCombine custom geographic hierarchies with LOD expressions to aggregate metrics at any level — from individual store to country — in a single view.
CSV-based geocodingExternal geocoding APIs + ETLAutomate coordinate lookups via APIs (Google, Mapbox, OpenCage) in a Python or Alteryx pipeline, generating the CSV programmatically before Tableau ingestion.
Static point mapsMAKELINE + Flow MapsUse MAKELINE() to draw origin–destination arcs between custom-geocoded points, visualizing logistics routes, migration patterns, or network connections.
Manual unknown resolutionFuzzy matching preprocessingApply string similarity algorithms (Levenshtein, Jaro-Winkler) in Python to auto-correct misspelled location names before they reach Tableau, reducing unknowns at scale.

From custom geocoding to advanced spatial analysis

As your spatial analysis needs grow, consider integrating Tableau with dedicated GIS tools. PostGIS provides a full spatial SQL engine; QGIS offers open-source desktop GIS for complex geoprocessing; and tools like Apache Sedona extend spatial capabilities to big data environments. Custom geocoding in Tableau serves as the translation layer that connects your organization's proprietary location semantics to this broader ecosystem of geospatial computation.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain why Tableau's built-in geocoding dictionary might fail to recognize a field labeled "Distribution Center" containing values like "DC-NorthEast" and "DC-Pacific." What fundamental assumption does Tableau's geocoder make about location fields, and how does custom geocoding address this limitation?
Show answer
Tableau's built-in geocoder relies on a dictionary of known administrative and postal geographic entities — countries, states, cities, ZIP codes, and similar standard divisions. When it encounters a field value like "DC-NorthEast," it searches this dictionary and finds no match because the value is a proprietary organizational identifier, not a recognized place name. The fundamental assumption is that location fields map to publicly standardized geographic entities. Custom geocoding addresses this by extending the dictionary with a user-supplied CSV that explicitly maps each proprietary identifier to a latitude–longitude pair, effectively teaching Tableau a new geographic vocabulary.

Question 2: BASIC CALCULATION

You have three campus buildings: Library (lat 42.3601, lon −71.0589), Engineering Hall (lat 42.3605, lon −71.0572), and Student Center (lat 42.3598, lon −71.0601). Write the exact contents of a custom geocoding CSV file (including the header row) that would allow Tableau to map a field called "Building" containing these three values.
Show answer
The CSV should have three columns and four rows (including the header). The header row is: Building,Latitude,Longitude. The data rows are: Library,42.3601,-71.0589 then Engineering Hall,42.3605,-71.0572 then Student Center,42.3598,-71.0601. This file uses UTF-8 encoding and decimal degrees in WGS 84. After importing via Map → Geocoding → Import Custom Geocoding, Tableau creates a new geographic role called "Building." You then assign this role to the Building field in your data pane and drag it onto the map.

Question 3: INTERMEDIATE

A colleague imports a custom geocoding CSV for 200 retail stores, but after assigning the geographic role, 15 stores still appear as unknown locations. The CSV file looks correct and all 200 rows are present. Describe at least three possible causes for this partial failure and the diagnostic steps you would take for each.
Show answer
First, check for case sensitivity or whitespace mismatches: if the data field contains "Store_045" but the CSV has "Store_045 " (trailing space), the join key will not match. Open both the CSV and the data source in a text editor and compare problematic values character by character. Second, verify encoding consistency: if the CSV was saved in Latin-1 but contains accented characters (e.g., "São Paulo"), Tableau may silently mangle the characters during import, breaking the match. Re-save the CSV as UTF-8. Third, check for duplicate keys with conflicting coordinates: if two rows in the CSV share the same store name but different lat/lon values, Tableau may resolve ambiguously or drop one. Deduplicate the CSV to ensure one row per unique identifier. A fourth possibility is a stale geocoding cache — remove the custom geocoding and re-import to force a fresh dictionary build.

Question 4: APPLIED

You are building a Tableau dashboard for a food delivery startup that operates in 12 cities. Your transactional data includes a field called "Zone" with values like "Downtown-Core," "Midtown-East," and "Airport-Area" — 47 zones in total. The company adds 3–5 new zones per month. Design a complete data pipeline (from coordinate acquisition to Tableau visualization) that keeps the geocoding current. Specify tools, file formats, scheduling, and how you would handle the ongoing updates.
Show answer
The pipeline has four stages. Stage 1 — Coordinate Acquisition: maintain a master zone database (e.g., a PostgreSQL table with columns zone_name, latitude, longitude, created_date). When a new zone is added, the operations team enters the zone center coordinates using a simple web form or Google Sheets that geocodes the address via the Google Geocoding API. Stage 2 — CSV Generation: a scheduled Python script (run weekly via cron or Airflow) queries the database and exports a fresh custom geocoding CSV using pandas.to_csv with UTF-8 encoding. Stage 3 — Tableau Integration: place the CSV in a shared network directory that Tableau Desktop and Server can access. Import the custom geocoding from this directory. On Tableau Server, configure the extract refresh schedule to align with the CSV update cadence. Stage 4 — Validation: include a dashboard sheet that counts unknown locations; if the count exceeds zero, trigger an email alert via Tableau Server subscriptions. This pipeline ensures that newly added zones are automatically resolved within one refresh cycle, typically within 24 hours of creation.

Question 5: CRITICAL THINKING

Compare and contrast the custom geocoding CSV approach with the MAKEPOINT() spatial calculation approach from both a software engineering and a data modeling perspective. Under what circumstances would you argue that MAKEPOINT() is architecturally superior to custom geocoding, and under what circumstances would the reverse be true? Consider maintainability, separation of concerns, performance, and the principle of a single source of truth.
Show answer
From a software engineering perspective, MAKEPOINT() is architecturally superior when coordinates are intrinsic properties of each record (e.g., GPS traces from IoT devices, geotagged social media posts). In this case, embedding the spatial computation in the Tableau calculation layer respects the single source of truth principle — the coordinates live in the transactional data, not in a sidecar file. It also eliminates the synchronization burden of keeping a CSV in sync with a growing dataset. From a data modeling perspective, however, custom geocoding is superior when the mapping from identifier to coordinate is a dimensional concern — a stable lookup that applies across multiple fact tables. Store locations, warehouse codes, and campus buildings are dimensional attributes; encoding them as a custom geocoding CSV is analogous to maintaining a dimension table in a star schema. This separation of concerns means the mapping can be updated independently of any specific dataset, and any workbook that imports the CSV inherits the resolution. Performance-wise, MAKEPOINT() computes spatial objects at query time, which can be slower for very large datasets on Tableau Server, whereas custom geocoding resolves at import time and is cached. Maintainability favors the CSV approach when the same identifiers appear across many workbooks (one CSV update propagates everywhere), and favors MAKEPOINT() when coordinates change per record or per row. In summary, treat custom geocoding as your dimension table strategy and MAKEPOINT() as your fact-embedded strategy, and choose based on whether the location semantics belong to the entity or to the observation.

SUMMARY

Lesson Summary

Summary

Tableau's built-in geocoding dictionary maps standard geographic entities to coordinates, but real-world datasets frequently contain proprietary identifiers that the dictionary cannot resolve, triggering unknown location warnings. Custom geocoding solves this by importing a structured CSV file — containing hierarchy columns, latitude, and longitude — that extends the internal dictionary. The CSV must use WGS 84 decimal degrees, Tableau-recognized column headers, and UTF-8 encoding. For small corrections, the Edit Locations dialog offers a manual alternative, while the MAKEPOINT() function creates spatial objects directly from coordinate columns in your data, bypassing the dictionary entirely.

Choosing the right strategy depends on scale and data architecture: Edit Locations suits one-off fixes, the custom geocoding CSV excels for reusable dimensional lookups across workbooks, and MAKEPOINT() is ideal when coordinates are embedded in every record. Once locations are resolved, you unlock advanced capabilities including spatial joins, flow maps with MAKELINE(), and density heatmaps — transforming a flat dataset into a rich geospatial narrative.

Varsity Tutors • Tableau • Custom Geocoding — Use custom geocoding and resolve unknown locations