DuckDB for Spatial Data

A spatial database with no server, reading the file you already have.

The DuckDB path, from a database that is just a file to remote partitioned GeoParquet. a spatial database with no server, reading the file you already have1a database in a filecolumnar, and fast2read anythingshp, GeoJSON, Parquet3CRS & indexeswhere it differs4joins at scaleremote, partitionedStage three is the surprise: ST_Transform and the spatial index do not behave as GeoPandas taught you

DuckDB reads a GeoParquet file, a shapefile or a remote URL and runs spatial SQL over it with nothing to install and nothing to load first. That makes it the fastest way to answer a question about a dataset too big for a GeoDataFrame and too small to justify PostGIS. These guides cover the spatial extension, reading and writing every format worth using, joins and aggregations at a scale GeoPandas cannot reach, the CRS handling that has no safety net, and the four ways a query that should take seconds takes an hour.

Stage three is the one to read carefully even if you know SQL. DuckDB’s CRS handling and its use of a spatial index both differ from what GeoPandas teaches, and both differ quietly — a transform that moves data to the wrong place, and a join that is fast for a reason other than the one you assumed.

The full path, in order

The concepts underneath the work, then each task, then the errors that task produces. Work down, or jump to the step you need.

  1. Columnar or Row Storage: Why DuckDB Is Fast on Wide Tables columnar row spatial storage 🧭 Concept
  2. How to Install and Load the DuckDB Spatial Extension install duckdb spatial ⚙️ How-To
  3. How to Read Shapefiles, GeoJSON and GeoParquet in DuckDB duckdb read spatial files ⚙️ How-To
  4. CRS in DuckDB: Why ST_Transform Moves Your Data to the Wrong Place duckdb crs projection 🧭 Concept
  5. How to Run a Spatial Join in DuckDB duckdb spatial join ⚙️ How-To
  6. How DuckDB Uses (and Does Not Use) a Spatial Index duckdb spatial index 🧭 Concept
  7. How to Aggregate Millions of Points into a Grid with DuckDB duckdb aggregate millions of points ⚙️ How-To
  8. How to Query Remote GeoParquet over HTTP with DuckDB duckdb remote geoparquet ⚙️ How-To
  9. How to Query Hive-Partitioned GeoParquet in DuckDB duckdb hive partitioned parquet ⚙️ How-To
  10. How to Move Data Between DuckDB and GeoPandas duckdb geopandas ⚙️ How-To
  11. DuckDB or PostGIS: Which One a Workflow Needs duckdb vs postgis 🧭 Concept
  12. DuckDB's Memory Model: Streaming, Spilling and Limits duckdb memory model 🧭 Concept
  13. How to Use DuckDB as the Engine in a GIS Pipeline duckdb gis pipeline ⚙️ How-To
  14. How to Benchmark DuckDB Against GeoPandas Honestly benchmark duckdb geopandas ⚙️ How-To
  15. Fixing a DuckDB Spatial Extension That Will Not Load duckdb spatial extension load error 🔧 Fix
  16. Fixing ST_Read Failures on Spatial Files in DuckDB duckdb st_read fails 🔧 Fix
  17. Fixing a DuckDB Spatial Join That Never Finishes duckdb spatial join slow 🔧 Fix
  18. Fixing DuckDB Out of Memory on a Large Spatial Query duckdb out of memory 🔧 Fix
  19. Fixing a Geometry Column Lost on Export from DuckDB duckdb geometry lost export 🔧 Fix

Topics this path covers

A path is a route; a topic is everything the site has on a subject. Open a topic to see the guides this path skips.

Other ways in