postgis-patterns

Document spatial design patterns for PostGIS, GeoDjango, and GeoAlchemy2.

1|Updated Apr 13, 2026
One-click install
npx skills add https://github.com/weorbitant/compound-engineering-feat-python-plugin --skill postgis-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgis-patterns
Source: https://github.com/weorbitant/compound-engineering-feat-python-plugin/tree/main/skills/postgis-patterns
Command: npx skills add https://github.com/weorbitant/compound-engineering-feat-python-plugin --skill postgis-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

PostGIS-patterns provides a structured collection of spatial design patterns and conventions to accelerate building GIS-enabled applications with PostGIS, GeoDjango, and GeoAlchemy2, ensuring consistent data modeling, querying, and performance best practices.

Core Features & Use Cases

  • Geometry vs geography guidance: when to store as geometry or geography and how SRID handling impacts queries.
  • Indexing and performance: recommended GiST indexes, bounding box filtering, and best practices for fast spatial queries.
  • Spatial queries and operations: common patterns for distance, containment, intersections, and spatial joins using PostGIS functions.
  • Framework integration: GeoDjango setup, PostGIS-enabled models, and GeoAlchemy2 integration examples for SQLAlchemy-based apps.
  • Reference material: ready-to-use reference documents and examples to accelerate implementation across projects.

Quick Start

Apply the patterns by reviewing the reference documents to implement PostGIS geometry and geography handling in your project.

Frequently Asked Questions about postgis-patterns

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

FAQPage Schema
How do I optimize slow spatial queries in PostGIS and GeoDjango?

Optimize slow PostGIS spatial queries by applying GiST indexes, utilizing bounding box filtering, and following recommended indexing conventions to accelerate spatial data retrieval in GeoDjango applications.

When should I use geometry vs geography data types in PostGIS spatial queries?

Choose between PostGIS geometry and geography types based on your spatial query requirements, as SRID handling impacts distance and containment calculations differently across geometry and geography data models.

Can I use PostGIS spatial patterns with SQLAlchemy and GeoAlchemy2 instead of GeoDjango?

PostGIS spatial patterns support SQLAlchemy with GeoAlchemy2 integration, providing setup examples and common spatial query operations as an alternative framework to GeoDjango for GIS-enabled applications.

What's the best way to handle SRID in PostGIS models for Django and GeoAlchemy2?

Handle SRID in PostGIS models by following structured spatial design patterns that ensure consistent data modeling and SRID handling across GeoDjango and GeoAlchemy2 implementations.

How do I perform spatial joins and intersections using common PostGIS ST_ functions?

Perform spatial joins and intersections using common PostGIS ST_ functions by following reference patterns for containment, distance, and intersection operations to ensure consistent spatial querying.