spatial-sql
/spatial-sql
Write, review, debug or optimize spatial SQL on an already chosen engine, including DuckDB Spatial, PostGIS, BigQuery GIS, Snowflake and Sedona. Use for spatial predicates, joins, indexes, query plans, CRS and metric/geodesic correctness. Route unresolved engine or cross-system architecture choices to open-map-stack; ordinary non-spatial SQL and casual place questions are outside this skill.
- Author
- jaakla ↗
- Repository
- open-gis ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 6
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Write, review, debug or optimize spatial SQL on an already chosen engine, including DuckDB Spatial, PostGIS, BigQuery GIS, Snowflake and Sedona. Use for spatial predicates, joins, indexes, query plans, CRS and metric/geodesic correctness. Route unresolved engine or cross-system architecture choices to open-map-stack; ordinary non-spatial SQL and casual place questions are outside this skill.
Original author description
Write, review, debug or optimize spatial SQL on an already chosen engine, including DuckDB Spatial, PostGIS, BigQuery GIS, Snowflake and Sedona. Use for spatial predicates, joins, indexes, query plans, CRS and metric/geodesic correctness. Route unresolved engine or cross-system architecture choices to open-map-stack; ordinary non-spatial SQL and casual place questions are outside this skill.
How it works
- Query workflow
- When the task expands
SKILL.md preview
--- name: spatial-sql description: "Write, review, debug or optimize spatial SQL on an already chosen engine, including DuckDB Spatial, PostGIS, BigQuery GIS, Snowflake and Sedona. Use for spatial predicates, joins, indexes, query plans, CRS and metric/geodesic correctness. Route unresolved engine or cross-system architecture choices to open-map-stack; ordinary non-spatial SQL and casual place questions are outside this skill." metadata: version: "0.4.0" --- # Spatial SQL Solve the query in the engine the user has chosen. Read `references/spatial-sql.md` for the relevant engine and query patterns, and `references/formats-and-crs.md` when coordinate or format semantics matter. When the user has dlt, Dagster, dbt, QGIS or Observable in their stack, read `references/established-stack.md` for ownership and integration boundaries. Preserve their chosen tools; retain source pins, GIS correctness and reproducible evidence. Do not duplicate their SQL, ingestion or scheduler definitions. ## Query workflow 1. Establish the engine/version, available spatial functions, geometry versus geography types, CRS/SRID, input grain, expected result and scale. Inspect the existing query and plan when available. Do not assume different engines share function signatures, boundary semantics or index behavior. 2. Express the intended spatial relationship precisely. Resolve intersects versus contains/covers, boundary inclusion, null/empty/invalid geometries, and whether several spatial matches should duplicate an entity or produce a single membership result. 3. Make distance, area and buffers use the intended units and method. A geographic geometry in EPSG:4326 does not acquire metre units from a numeric threshold. Use the engine's explicitly supported geodesic/geography operation, or a projected CRS whose area of use contains the data's known extent. For distance and within-distance tests on an unknown or wide extent, prefer an operation the engine documents as geodesic for the geometry types involved; do not guess a UTM zone or national grid. A geography type does not make every operation geodesic: check buffers and other constructions per operation. Assigning an SRID is not coordinate transformation; Web Mercator is not a general metric-analysis CRS. 4. Preserve analytical correctness while improving execution. Consider spatial indexes or candidate filters, predicate pushdown, partition pruning and join cardinality. An expression or cast can prevent use of an existing index; verify the relevant plan instead of promising index use by syntax. 5. Run a small meaningful control when an engine is available: qualifying and non-qualifying features, a boundary, and duplicate matches where relevant. Report actual execution evidence separately from a reasoned SQL review. An unavailable engine is `not_testable`, not a successful query run. Return corrected SQL, consequential assumptions and a short explanation of correctness and performance. Do not create a full GIS project for a bounded query review. Preserve source data; an optimization must not silently change the metric, feature population or authoritative geometry. ## When the task expands Engine selection, shared-system design and joint compute/storage/delivery trade-offs belong with an installed `open-map-stack` or an explicit architecture discussion. Compiling a material analysis belongs with the generalist or `reproducible-gis-project`. Keep the SQL contribution bounded and supply the assumptions/evidence needed for that handoff; do not claim to have completed the whole analysis. No project template, worked example or OpenMapStack CLI is needed for a bounded query task. Hand off the SQL and its assumptions to an installed `open-map-stack` or `reproducible-gis-project` if the user also wants a full project. Sibling skills are optional and are never automatically installed. For optional product expertise, read `references/companion-skills.md`. Keep GIS correctness and the task boundaries above when using a companion.
Files in this package (6)
- SKILL.md 4 KB
- agents/openai.yaml 1 KB
- references/companion-skills.md 3 KB
- references/established-stack.md 9 KB
- references/formats-and-crs.md 21 KB
- references/spatial-sql.md 11 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · jaakla/open-gis | 100 | MIT |
| wiatrek-kevin-s/columbus | 100 | Apache-2.0 |
Identical content appears in 1 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version ff0cd225699a (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100postgis-spatial-sql
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… - 100postgis-spatial-query-optimization
Architect, index, and optimize spatial databases using PostgreSQL and PostGIS. Master geometry vs geography data types, spatial reference systems (SRID 4326 vs 3857), GiST and SP-GiST indexing, spatial joins, K-Nearest Neighbor (KNN) distance queries, and spatial clustering with… - 100duckdb-spatial
Use when doing spatial analysis inside a DuckDB database or SQL pipeline — INSTALL spatial / LOAD spatial, ST_Read over Shapefile/GeoPackage/GeoJSON, ST_Point/ST_GeomFromText, ST_Intersects/ST_Contains/ST_Buffer joins, ST_Area_Spheroid, ST_AsMVT tiles, DuckDB-WASM in the… - 100malloy
Malloy is an open-source semantic modeling and query language that compiles to SQL and runs on DuckDB, BigQuery, Snowflake, PostgreSQL, MySQL, Trino, Presto and Databricks. Use when the user wants to write Malloy models, sources, views, joins or nested queries, run .malloy files… - 95study-db
Read-only catalog queries for Postgres/PostGIS, SQL Server, MySQL, GeoPackage: spatial columns, indexes, sizes, FKs, slow spatial queries. Apply when documenting or diagnosing a database. - 100open-map-stack
Plan and execute ambiguous or multi-stage GIS work, jointly choosing authoritative sources, compute, storage and delivery for the scale and team. Covers vector/raster/point-cloud analysis, routing, QGIS, tiles and web maps. Use for unresolved geospatial architecture and…