Spatial Data Management with DuckDB#
Introduction#
Welcome to the official repository for Spatial Data Management with DuckDB: From SQL Basics to Advanced Geospatial Analytics. This repository contains all the code examples featured in the book, designed to help you learn and apply DuckDB for geospatial analysis.
Get the Book#
🇺🇸 English Full-Color Print Edition (400 pages): Coming soon.
🇺🇸 English PDF Edition (400 pages): Available on Leanpub (link)
Cite the Book#
If you use this book in your research or teaching, please consider citing it as follows:
Wu, Q. (2025). Spatial Data Management with DuckDB: From SQL Basics to Advanced Geospatial Analytics. Independently published. https://duckdb.gishub.org

Table of Contents#
Preface
Introduction
Who This Book Is For
What This Book Covers
Getting the Most Out of This Book
Conventions Used in This Book
Downloading the Code Examples
Video Tutorials and Supplementary Resources
Community and Feedback
Acknowledgments
About the Author
Licensing and Copyright
DuckDB Foundations
Getting Started with DuckDB
Essential SQL for Spatial Analysis
DuckDB Python Integration
Spatial Data Operations
Loading Spatial Data Formats
Exporting and Converting Spatial Data
Geometry Operations and Functions
Spatial Queries and Relationships
Advanced Spatial Joins
Interactive Data Visualization
Working with Vector Tiles and PMTiles
Real-World Geospatial Analytics
Analyzing the US National Wetlands Inventory
Analyzing Global Building Footprints
Analyzing NYC Taxi Data
Developing Interactive Dashboards with Streamlit and Solara
How to Run Code Examples#
The code examples are organized into folders, each corresponding to a chapter in the book. The code examples are written in Python and can be run using MyBinder, Google Colab, or Docker.
Using MyBinder#
The code examples can be run using MyBinder.
Using Google Colab#
The code examples can be run using Google Colab.
Video Tutorials#
Complementing the written content, this book is supported by a comprehensive series of video tutorials that walk through key concepts and provide additional examples:
https://www.youtube.com/playlist?list=PLAxJ4-o7ZoPe9SkgnophygyLjTDBzIEbi
The videos are designed to complement, not replace, the written material. They’re particularly helpful for:
Visual learners who benefit from seeing code being written and executed
Understanding complex concepts through multiple explanations
Learning about the development workflow and best practices
Seeing how to approach problems and debug issues
The playlist is organized to follow the book’s structure. You can watch them in order as you progress through the book, or jump to specific topics as needed.
The videos were created in Fall 2023 when I was teaching the Spatial Data Management course at the University of Tennessee. Although the course has concluded, the videos remain relevant and can be used as a reference for the book. Additional videos will be added in the future.
Licensing and Copyright#
This book embraces the principles of open science and open education. To support transparency, learning, and reuse, the code examples in this book are released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license. This means you are free to copy, modify, and distribute the code, even for commercial purposes, as long as appropriate credit is given.
Please attribute code usage by citing the book or linking to the GitHub repository:
Wu, Q. (2025). Spatial Data Management with DuckDB: From SQL Basics to Advanced Geospatial Analytics. Independently published. https://duckdb.gishub.org
While the code is freely available, the text, figures, and images in this book are copyrighted by the author and may not be reproduced, redistributed, or modified without explicit permission. This includes all written content, custom diagrams, and embedded visualizations unless otherwise noted.
If you wish to reuse or adapt any non-code material from the book (for example, for teaching, presentations, or publications), please contact the author to request permission.
This dual licensing approach helps balance open access to learning materials with the protection of original creative work. Thank you for respecting these terms and supporting the open-source geospatial community.