geojson-postgis
PostGIS Geometry Rows → GeoJSON FeatureCollection
Use this skill when your data already has a PostGIS geometry column (typically geom) and you need to serve it to a web map as GeoJSON.
This is the canonical pattern:
- output WGS84 (EPSG:4326) for clients
- return a FeatureCollection
- keep
propertiesas “all columns minus geom” (or explicitly selected fields)
When to use
- You have a table with
geom(geometry) and other columns - You are building or updating an API endpoint that returns map layers
- You want consistent GeoJSON structure and coordinate system
Core rules
- Serve geometry in EPSG:4326 for web clients
More from mmbmf1/geospatial-skills
geojson-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-dwithin
Distance-based spatial filtering with ST_DWithin, using index-friendly and unit-safe patterns.
8postgis-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