DuckDB for Spatial Data

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

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.

20 Steps in this path

The full path, in order

20 guides: 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