← All writing

1 min read

Spatial Joins at Scale with DuckDB and SedonaDB

A field guide to moving from ad hoc geographic joins toward reproducible, columnar spatial analytics.

  • spatial
  • data engineering
  • duckdb

Geospatial joins look simple until the number of records, geometries, and edge cases grows. A thoughtful lakehouse workflow separates the geometry work from the orchestration so both remain inspectable.

Start with a reliable geometry contract

Treat spatial reference systems, validity, and bounding boxes as data quality requirements rather than cleanup steps at the end of an analysis.

SELECT
  parcel.id,
  neighborhood.name
FROM read_parquet('parcel.geo.parquet') AS parcel
JOIN read_parquet('neighborhood.geo.parquet') AS neighborhood
  ON ST_Intersects(parcel.geometry, neighborhood.geometry);

Keep the expensive work columnar

DuckDB is a strong fit for fast local exploration and repeatable SQL. SedonaDB extends that workflow when distributed execution, spatial partitioning, and larger datasets matter.

The architecture is less important than the contract around it: stable IDs, explicit coordinate systems, validated geometry, and tests for the boundary cases.