Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add znlgis/opengis-skills --skill duckdb-spatialgit clone --depth 1 https://github.com/znlgis/opengis-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/znlgis/opengis-skills/duckdb-spatial)<a href="https://agentmods.dev/skills/znlgis/opengis-skills/duckdb-spatial"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/duckdb-spatial/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/duckdb-spatial"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/duckdb-spatial.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00125 | $0.04978 |
| Opus 5.5 | $0.00050 | $0.01991 |
| Sonnet 5.5 | $0.00025 | $0.00996 |
| Haiku 4.5 | $0.00013 | $0.00498 |
Grade A, and why
duckdb-spatial scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 371 lines — stays where its author put it; the contents beside it link to each section on GitHub.
项目地址: https://github.com/duckdb/duckdb-spatial
官方文档: https://duckdb.org/docs/stable/core_extensions/spatial/overview
函数参考: https://duckdb.org/docs/stable/core_extensions/spatial/functions
DuckDB 包(PyPI): 2.0.0(截至 2026-10)
扩展分发: 随 DuckDB 版本自动匹配,INSTALL spatial 从 extensions.duckdb.org 拉取(无独立版本号)
许可证: MIT
概述
DuckDB Spatial 是 DuckDB 官方的核心扩展,把列式分析数据库变成可读写地理数据的空间分析工具。它基于 OGC Simple Features 模型增加 GEOMETRY 类型,底层用 GEOS 做拓扑运算、用 PROJ 做坐标转换、用 GDAL 读文件。
- 零服务依赖:进程内运行,扩展按需安装,无需 PostGIS 或服务器
- 轻量几何类型:POINT_2D / LINESTRING_2D / POLYGON_2D / BOX_2D 有原生函数重载,比通用 GEOMETRY 路径快
- ST_Read 表函数:通过 GDAL 直接查询 Shapefile、GeoPackage、GeoJSON、FlatGeoBuf 等
- SQL 即分析:空间谓词、聚合(ST_Union_Agg、ST_Extent_Agg)、瓦片编码(ST_AsMVT)
- 与 Parquet/CSV/JSON 同库联查:空间表可直接 JOIN 普通表,无须导入导出
- WASM 可用:同一扩展编译为 WebAssembly,GeoLibre 与 DuckDB-WASM 前端都靠它
扩展自带 GEOS/PROJ/GDAL 静态链接版本,机器上不需要另外安装 GDAL。
环境准备
安装 DuckDB
# 1) Python(推荐用于脚本与 Notebook)
pip install duckdb==2.0.0
# 2) conda / mamba
conda install -c conda-forge duckdb
# 3) 官方 CLI(单文件可执行)
# Windows: 下载 duckdb_cli-windows-amd64.zip 后解压
# macOS: brew install duckdb
安装 spatial 扩展
INSTALL spatial;
LOAD spatial;
INSTALL 会把扩展写入用户目录(~/.duckdb/extensions///),只需一次;之后每次会话 LOAD spatial 即可。spatial 不属于 autoloadable 扩展,忘记 LOAD 时所有 ST_* 函数都会报"不存在"。
验证
import duckdb
con = duckdb.connect()
con.execute("INSTALL spatial; LOAD spatial;")
print(con.execute("SELECT duckdb_version()").fetchone())
print(con.execute("SELECT ST_AsText(ST_Point(116.39, 39.90))").fetchone())
print(con.execute("SELECT extension_version FROM duckdb_extensions() WHERE extension_name='spatial'").fetchone())
print(con.execute("SELECT duckdb_proj_version()").fetchone())
预期能打印 POINT (116.39 39.9) 与 PROJ 版本号;任一失败即扩展未正确加载。
核心 API
几何构造与序列化
| 函数 | 作用 | 返回 |
|---|---|---|
| ST_Point(x, y) / ST_MakePoint(x, y) | 构造点(两者等价,后者为 PostGIS 兼容名) | GEOMETRY |
| ST_GeomFromText(wkt [, ignore_invalid]) | 从 WKT 解析 | GEOMETRY |
| ST_GeomFromGeoJSON(json) / ST_AsGeoJSON(geom) | GeoJSON fragment 互转 | GEOMETRY / JSON |
| ST_GeomFromWKB(blob) / ST_AsWKB(geom) | WKB 互转 | GEOMETRY / WKB_BLOB |
| ST_MakeEnvelope(minx, miny, maxx, maxy) | 矩形面 | GEOMETRY |
| ST_MakeLine(list_of_points) / ST_MakePolygon(ring) | 线/面构造 | GEOMETRY |
| ST_AsText(geom) | 输出 WKT | VARCHAR |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today First seen · 371 lines · 125 tokens per session scan A 85b336cf52f2
duckdb-spatial is a skill published in the GitHub repository znlgis/opengis-skills (75 stars, last pushed yesterday), licensed MIT. It adds 125 tokens to every session and 4,978 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-28.
Other skills, from other repositories
portaljs-add-geo
Auto-ingest a geospatial file (GeoJSON, Shapefile, GeoPackage, KML/KMZ, FlatGeobuf, CSV-with-geometry) into a PortalJS portal on the user's own machine, with no server. Normalizes CRS to EPSG:4326, derives a PMTiles render tier and a GeoParquet query tier, pushes all three artifacts to Cloudflare R2 via Git LFS, and…
network-data-analysis
Ad-hoc read-only SQL analysis over exported network data (Zeek logs, Suricata eve.json, generated reports) using DuckDB. Use when aggregating across a packet capture's sessions, correlating IDS alerts with connection metadata, or answering counting and grouping questions that a per-log view cannot.
postgresdb
Use when PostgreSQL engine behaviour decides the answer — schema and type design, index choice, reading EXPLAIN on a slow query, zero-downtime DDL and backfills, or ops (roles, RLS, pooling, vacuum, partitioning, PITR). PG16, ORM-agnostic. NOT portable query logic (that is sql), NOT a managed provider's platform…
squix
Run SQL queries across databases (Postgres, MySQL, SQLite, etc.) via the squix CLI. Use for running named queries, exploring schema, or parameterized queries. Always use -f for non-interactive output.
relational-database-design
Designs or reviews a relational database schema for a given domain. Covers table structure, normalization, indexes, constraints, and migration strategy. Invoked when the user asks to design a schema, review a database structure, or optimize a data model.
sql-query-optimization
Diagnoses and optimises slow SQL queries using EXPLAIN ANALYZE. Covers identifying bottlenecks (sequential scans, bad estimates, heap fetches), index strategy, query rewrites, and verification. Invoked when the user asks to optimize a query, fix a slow database query, or improve database performance.