# postgis-spatial-sql

> Claude/Codex skill by [@muend](https://omgskills.com/library/muend/index.md) · 35 stars · Updated 2026-10-17

Invoke whenever spatial SQL or its execution backend is the decision: PostGIS, DuckDB Spatial, SpatiaLite, ST\_\* functions, recurring spatial joins, concurrent/growing workloads, or large GeoParquet queries. Covers backend selection, schemas, GiST/BRIN indexes, KNN, geometry versus geography, correctness benchmarks, and EXPLAIN optimization. Use PostGIS for managed concurrent services and embedded engines for bounded local analytics when evidence supports that choice. Use geo-data-engineering for acquisition, conversion, and file-based ETL without spatial SQL.

Tags: agent-skills, ai, ai-agents, claude-code, codex, geoai, geospatial, gis, github-copilot, google-earth-engine, lidar, machine-learning, postgis, remote-sensing, spatial-analysis, spatial-data-science

## Install

```sh
git clone https://github.com/muend/geoai-skills /tmp/geoai-skills && ln -s /tmp/geoai-skills/skills/postgis-spatial-sql ~/.claude/skills/postgis-spatial-sql
```

## From README

PostGIS & Spatial SQL Purpose: correct-and-fast spatial SQL. The two recurring failure modes are semantic (geometry vs geography, SRID mismatches → wrong answers) and performance (missing index → hour-long joins); this skill guards both. When the database is the right tool Move from files/GeoPandas to PostGIS when any of: features \> a few million, concurrent readers/writers, repeated ad-hoc querying, a serving API on top, or transactional integrity needs. For single-shot analytical scans over GeoParquet, DuckDB Spatial is often the fastest zero- path — same SQL mindset, no server. When requirements are incomplete, do not turn this heuristic into a final recommendation. First obtain current and forecast data volume, concurrency, delivery and mutation pattern, latency/SLA, serving needs, and operational ownership (including backup and recovery).

## Links

- HTML page: https://omgskills.com/library/muend/geoai-skills/skills/postgis-spatial-sql/
- GitHub: https://github.com/muend/geoai-skills
- Author: [@muend](https://omgskills.com/library/muend/index.md)

## More from this repo

- [arcgis-pro-automation](https://omgskills.com/library/muend/geoai-skills/skills/arcgis-pro-automation/index.md) — Automate controlled local ArcGIS Pro and ArcPy workflows through arcgis-mcp-bridge: inspect .aprx projects and file...
   - [@muend](https://omgskills.com/library/muend/index.md) · 35 stars
- [cartography-geoviz](https://omgskills.com/library/muend/geoai-skills/skills/cartography-geoviz/index.md) — Always invoke before answering any request to create, compare, design, or review a user-facing map, even if the request...
   - [@muend](https://omgskills.com/library/muend/index.md) · 35 stars
- [change-detection](https://omgskills.com/library/muend/geoai-skills/skills/change-detection/index.md) — Change analysis, once the observations are comparable.
   - [@muend](https://omgskills.com/library/muend/index.md) · 35 stars
