duckdb-spatial

Enable geospatial analysis in DuckDB with H3 indexing and spatial queries.

60|13|Updated Dec 22, 2025
One-click install
npx skills add https://github.com/plurigrid/asi --skill duckdb-spatial
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: duckdb-spatial
Source: https://github.com/plurigrid/asi/tree/main/skills/duckdb-spatial
Command: npx skills add https://github.com/plurigrid/asi --skill duckdb-spatial

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables geospatial analysis with DuckDB Spatial, including H3 hex indexing, spatial queries, and GF(3) coloring to color data deterministically.

Core Features & Use Cases

  • Geospatial SQL: Spatial types, functions, and indexing compatible with DuckDB Spatial.
  • H3 Indexing: Convert coordinates to H3 indices and retrieve cell boundaries.
  • GF(3) Coloring: Deterministic trit-based coloring for analytical coloring of features.
  • GeoParquet & CRS: Read/write geospatial Parquet and transform coordinate reference systems.

Quick Start

Install the spatial extension, load h3, and run examples like converting lat/lon to an H3 index and querying features by distance.

Frequently Asked Questions about duckdb-spatial

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform spatial queries with DuckDB?

DuckDB Spatial enables spatial queries through PostGIS-compatible functions for point-in-polygon, distance, and proximity calculations. Load the spatial extension, define geometry columns (POINT, LINESTRING, POLYGON), and use SQL functions to query features by location, distance, or containment without separate GIS software.

What is H3 indexing and how do I use it for geospatial analysis?

H3 indexing converts latitude/longitude coordinates into hierarchical hexagonal cells for efficient geospatial aggregation. DuckDB Spatial provides H3 functions to convert coordinates to hex indices, retrieve cell boundaries, and perform spatial operations at multiple resolutions, enabling scalable analysis of point clouds and regional data.

Can I read and write geospatial data with DuckDB?

Yes. DuckDB Spatial supports GeoParquet I/O for reading and writing geospatial Parquet files with coordinate reference system transformations. This enables seamless interchange of spatial data across GIS workflows, urban planning, and analytics pipelines without format conversion.

How do I deterministically color geospatial features in my analysis?

GF(3) coloring applies deterministic trit-based coloring to geospatial features for analytical visualization and classification. DuckDB Spatial includes GF(3) functions to assign colors consistently across datasets, useful for distinguishing spatial regions, administrative boundaries, or analysis categories.

Does DuckDB work for large-scale geospatial workflows in logistics and urban planning?

Yes. DuckDB Spatial handles spatial indexing, hex grids, and efficient proximity queries at scale, making it suitable for logistics route optimization, urban planning analysis, and environmental monitoring. Coordinate system transformations and GeoParquet support integrate with existing GIS pipelines.

What spatial data types does DuckDB Spatial support?

DuckDB Spatial supports standard geometry types including POINT, LINESTRING, POLYGON, and MultiVariant geometries. Combined with spatial indexing and H3 hexagonal grids, these types enable comprehensive geospatial workflows from simple coordinate queries to complex multi-feature spatial joins.