Skip to content
Back to skills

Postgis Conventions

ASecurity

Spatial table rules: naming, SRID, indexes, area in UTM, ingest validation, safe migrations. PostGIS with SQL Server and GeoPackage equivalents. Apply to any SQL, migration or ORM model with geometry.

  • 8 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 19, 2026
ai-agentsgosql

Security analysis

A100/100

Scanned September 19, 2026

npx -y skills add Adilmunawar/ZD-claude-plugin --skill postgis-conventions --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Postgis Conventions?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Postgis Conventions
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adilmunawar-postgis-conventions/badge)](https://www.skillsdirectory.com/skills/adilmunawar-postgis-conventions)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: postgis-conventions
description: Spatial table rules: naming, SRID, indexes, area in UTM, ingest validation, safe migrations. PostGIS with SQL Server and GeoPackage equivalents. Apply to any SQL, migration or ORM model with geometry.
---

# Spatial table conventions

- Geometry column is `geom`, typed + SRID-constrained: `geom geometry(MultiPolygon, 4326)`. (.NET/EF Core: `public MultiPolygon Geom { get; set; }` + `HasColumnType("geometry(MultiPolygon,4326)")`.)
- Every geometry column gets a spatial index in the same migration: `CREATE INDEX ix_<table>_geom ON <table> USING GIST (geom);` (EF: `.HasIndex(x => x.Geom).HasMethod("gist")`; SQL Server: `CREATE SPATIAL INDEX`).
- Naming: `<domain>_<thing>[_<season>]` snake_case — `parcels_<area>`, `crop_sugarcane_2026`, `admin_tehsil`, `flood_extent_2025`.
- Mandatory columns on feature tables: `id` PK, `source_id` (original ID), `source` (gee-export | model-vN | survey | kml), `created_at`, `updated_at`.
- Area: `area_ha numeric GENERATED ALWAYS AS (ST_Area(ST_Transform(geom, 32642))/10000) STORED` — never `ST_Area` on 4326 (see `pakistan-crs` for zone choice).
- Ingest: `ST_Multi(ST_MakeValid(ST_Transform(geom, 4326)))`; reject `NOT ST_IsValid(geom) OR ST_IsEmpty(geom)`.
- Dashboards read from views/materialized views refreshed by the ingest job.
- Display copies: `ST_SimplifyPreserveTopology(geom, tol)` into `geom_simple` or a `_display` view.
- Destructive statements need a `_bak_YYYYMMDD` copy and explicit approval (zd-core hooks enforce the prompt).
- Credentials: env vars / `appsettings` + user-secrets / `.env` — never in code or chat.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…