01 / 20

Spatial Joins
in Tableau

Learn how to combine geographic data by linking spatial files through location-based relationships: containment, intersection, and proximity.

Tableau

What Is a Spatial Join?

A spatial join is a method of combining two datasets based on the geographic relationship between their features, rather than matching on a shared column like a regular join. Instead of asking "Do these rows share the same ID?", a spatial join asks: "Do these shapes overlap, touch, or contain each other on a map?"

Understanding Spatial Files

Shapefile (.shp)
A multi-file format storing geometry, attributes, and projection info. The most common spatial format in GIS.
GeoJSON (.geojson)
A lightweight, human-readable JSON format for encoding geographic features. Great for web applications.
KML (.kml)
An XML-based format originally designed for Google Earth. Stores points, lines, polygons, and imagery overlays.

Three Core Geometry Types

Points Stores, schools Lines Roads, rivers Polygons Zip codes, states

Every spatial file stores one of these geometry types. When performing a spatial join, the relationship condition you can use depends on which geometry types you are joining.

How Spatial Joins Work

Polygon Layer ZIP Code Boundaries 90210 | geometry 90211 | geometry Point Layer Store Locations Store A | lat, lng Store B | lat, lng Intersects Joined Result Store A | 90210 | geometry

Spatial Relationship Types

Intersects Any overlap Contains Fully inside d Within Distance Proximity buffer

Spatial vs. Regular Join

Spatial Join Regular Join
Match Condition Geographic relationship Shared column value
Requires At least one spatial file Common key field
Example Point inside polygon Order ID = Order ID
Join Types Inner, Left, Right, Full Inner, Left, Right, Full
Use Case No common field exists Tables share a key

Why Spatial Joins Matter

Enrich Data
Attach geographic context to raw records: which district, zone, or region does each data point belong to?
No Key Needed
When your datasets lack a shared column, geography becomes the join key. Location bridges the gap.
Proximity Analysis
Find all features within a certain distance: customers near stores, incidents near landmarks, sensors near faults.

How to Perform a Spatial Join

1
Connect your spatial file. Go to Data Source tab and add a spatial file (Shapefile, GeoJSON, KML) as your primary connection.
2
Add a second data source. Drag another file (spatial or non-spatial with lat/lng) into the canvas beside the first.
3
Set the join condition. Click the join icon. Under "Join Clause", select the geometry fields and choose Intersects, Contains, or Within Distance.
4
Choose the join type. Select Inner, Left, Right, or Full outer join depending on whether you want all records or only matches.
5
Build your visualization. Drag the joined fields onto the canvas. Both data sources' fields are now available together.

Example: Stores in Districts

District A District B District C District D S1 S2 S3 S4 Store District

Example: Within Distance

Warehouse 5 km C1 C2 C3 C4 C5 Joined Not joined

Example: Polygon to Polygon

County Flood Zone 1 Flood Zone 2 Flood Zone 3 (no overlap) ✓ Intersects ✕ No match

Using Latitude/Longitude Data

You don't always need a spatial file for both sides of the join. If your data source contains Latitude and Longitude columns, Tableau can generate point geometry on the fly and use it in a spatial join.

1
Assign geographic roles. Right-click Latitude → Geographic Role → Latitude. Repeat for Longitude.
2
Create a calculated field. Use MAKEPOINT(Latitude, Longitude) to generate a geometry field from the two columns.
3
Join on the geometry. Use the MAKEPOINT field as the join clause against the spatial file's geometry column.

Key Spatial Functions

MAKEPOINT
Creates a point geometry from latitude and longitude values.
MAKELINE
Creates a line geometry from two point geometries (origin to destination).
DISTANCE
Calculates the distance between two point geometries in specified units (km, mi).
BUFFER
Creates a circular polygon around a point at a specified radius. Powers "Within Distance" logic.

Common Mistakes

✕ Wrong File Format
Trying to spatial join a CSV with no geometry and no lat/lng. Tableau needs geographic data to create a spatial relationship.
✕ Mismatched Projections
Two spatial files using different coordinate systems can produce incorrect join results. Always verify they use the same projection (typically WGS 84).
✕ Forgetting MAKEPOINT
Having lat/lng columns but not converting them to a point geometry with MAKEPOINT. Tableau won't auto-detect these as joinable spatial fields.

Spatial Join Summary

Concept Key Detail
What it does Joins data based on geographic overlap
Requires At least one spatial file or MAKEPOINT field
Default condition Intersects
Other conditions Contains, Within Distance
Supported formats Shapefile, GeoJSON, KML, MapInfo TAB, TopoJSON
Key function MAKEPOINT(lat, lng)
Common pitfall Boundary duplicates with Intersects

Question 1 of 5

What does a spatial join use as its join condition instead of a shared column?

Question 2 of 5

You have a CSV file with Latitude and Longitude columns but no geometry field. Which Tableau function do you need to use before performing a spatial join?

Question 3 of 5

A school district wants to determine which district boundary each school falls inside. Which spatial relationship condition should they choose?

Question 4 of 5

Which of the following is NOT a spatial file format natively supported by Tableau?

Question 5 of 5

A point feature sits exactly on the boundary between two polygon features. If you use Intersects, what happens?