postgis-dwithin
Installation
SKILL.md
ST_DWithin (Distance / Proximity Queries)
Use this skill when you need to find features within a given distance of another geometry:
- “points within X meters of a line”
- proximity searches around a point
- replacing expensive buffer + intersects patterns
Core rules
ST_DWithinis faster thanST_Distance < x- Units depend on input type:
geometry→ SRID unitsgeography→ meters
- Geometries must be in the same SRID
- Prefer
ST_DWithinover buffering when you only need a boolean test
Canonical patterns
Related skills
More from mmbmf1/geospatial-skills
geojson-postgis
Serialize PostGIS geometry rows into a GeoJSON FeatureCollection for map display (4326, Feature + properties).
21geojson-points
Convert JSON rows with latitude/longitude fields into a GeoJSON FeatureCollection using raw PostGIS SQL.
16geojson-wkt
Convert JSON rows with WKT geometry strings into a GeoJSON FeatureCollection using raw PostGIS SQL.
13postgis-distance
Compute numeric distances safely with ST_Distance (geometry vs geography units) and pair with ST_DWithin for performance.
9postgis-nearest
Find nearest features efficiently using PostGIS KNN (<->) and distance ordering (with SRID/unit guidance).
7postgis-extract-xy
Extract longitude and latitude from PostGIS geometries using ST_X and ST_Y safely.
7