postgis-spatial

Filter geographic candidates by regions using PostGIS spatial queries.

Updated Oct 26, 2025
One-click install
npx skills add https://github.com/discountedcookie/10x-mapmaster --skill postgis-spatial
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgis-spatial
Source: https://github.com/discountedcookie/10x-mapmaster/tree/main/.opencode/skills/postgis-spatial
Command: npx skills add https://github.com/discountedcookie/10x-mapmaster --skill postgis-spatial

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill demonstrates spatial queries and region-based candidate filtering with PostGIS.

Core Features & Use Cases

  • Geospatial queries: ST_Intersects, ST_Contains, ST_DWithin usage patterns.
  • Geographic candidate filtering: Spatially filter and split regions for questions.
  • Geometry handling: Storage and centroid extraction for different geometry types.

Quick Start

Use ST_Intersects/ST_Contains patterns to filter candidate places by a defined region.

Frequently Asked Questions about postgis-spatial

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

FAQPage Schema
How do I filter places by geographic region using PostGIS?

Use ST_Intersects or ST_Contains with geometry columns in PostGIS to filter candidate places against a defined region. Store geometries with SRID 4326, create a GiST index on the geometry column, and query using spatial operators to return matching locations.

What PostGIS functions work best for region-based candidate filtering?

ST_Intersects checks if geometries overlap, ST_Contains verifies if one geometry fully contains another, and ST_DWithin filters by distance. Combine these with GiST indexes on geometry columns for efficient spatial queries across large candidate datasets.

Can I use PostGIS to compute distances and filter candidates by proximity?

Yes. ST_DWithin filters places within a specified distance of a point or region, leveraging GiST indexes for performance. Use it in WHERE clauses to generate candidate sets based on geographic proximity without computing all pairwise distances.

How do I handle multiple geometry types in PostGIS for spatial queries?

Store different geometry types (points, polygons, lines) in the same column with consistent SRID handling, typically SRID 4326 for geographic data. Use spatial operators like ST_Intersects and ST_Contains to work across mixed geometry types in a single query.

Why should I use GiST indexes for PostGIS spatial queries?

GiST indexes accelerate spatial queries by indexing geometry bounds, enabling fast filtering of large candidate sets. Without indexes, ST_Intersects, ST_Contains, and ST_DWithin queries perform full table scans, degrading performance on datasets with many geometries.

Do I need a custom function to filter by included and excluded regions in PostGIS?

A plpgsql function can encapsulate region-based filtering logic, applying ST_Intersects for included regions and ST_Disjoint for excluded ones. This simplifies repeated queries and centralizes spatial logic for candidate filtering workflows.