Pg_featureserv (developed by Crunchy Data and open-source contributors for Linux, Windows, macOS, and Docker) is a lightweight, single-binary spatial REST server written in Go that exposes PostgreSQL/PostGIS tables and spatial SQL functions directly as standard OGC API - Features endpoints. Built for Web GIS developers, backend spatial engineers, and GIS architects who need clean GeoJSON/JSON feature APIs without maintaining a heavy Java application server, pg_featureserv automatically discovers PostGIS geometry tables and custom database functions so web maps (`MapLibre`, `OpenLayers`, `Leaflet`) and `QGIS` clients can query, filter, and stream vector data immediately.
1. In-Depth Review: Why Spatial Backend & Web GIS Teams Use pg_featureserv
- Zero-Config OGC API - Features & GeoJSON Endpoints from PostGIS: Connects straight to PostgreSQL/PostGIS and publishes every authorized spatial table as RESTful collections with built-in HTML map preview pages, OpenAPI documentation, and GeoJSON outputs.
- Turn Custom PostGIS SQL Functions into Live Spatial APIs: Automatically exposes database functions under `postgisftw` schema as parameterized REST endpoints—letting you serve dynamic buffers, nearest-neighbor searches, or routing queries directly from SQL.
- Single Go Binary & Docker Container with Minimal Footprint: Ships as a fast standalone executable or lightweight container with near-zero memory overhead—ideal alongside `pg_tileserv` for modern cloud-native PostGIS web architectures.
2. Key Features & Capabilities
- OGC API - Features Compliant REST & GeoJSON Service: Serves feature collections, individual feature items, bounding-box filters (`bbox`), attribute queries, sorting, and pagination (`limit`/`offset`).
- Dynamic Spatial Functions (`postgisftw` Schema): Publish custom PostgreSQL/PostGIS functions as HTTP GET endpoints with query parameters for on-the-fly geoprocessing.
- Built-In Interactive Web Map & OpenAPI UI: Includes an integrated browser UI to preview GeoJSON collections on a map and test API endpoints without third-party tools.
- Coordinate Reference System (`CRS`) & Geometry Simplification Controls: Supports output reprojection (`crs`), property selection (`properties`), and tolerance-based geometry simplification (`precision`/`transform`) on the fly.
- Seamless Integration with `QGIS`, `Leaflet`, `OpenLayers` & `MapLibre`: Connects directly to QGIS `WFS / OGC API - Features` data sources and modern JavaScript mapping libraries.
- 100% Free & Open-Source (`Apache-2.0` License): Free to deploy across commercial, government, academic, and cloud microservices.
- Official Links: Download, Documentation & Source Code
Always download pg_featureserv binaries, Docker images, and documentation directly from official Crunchy Data portals:
- Official pg_featureserv Documentation & Setup Guide: https://access.crunchydata.com/documentation/pg_featureserv/latest/
- Official pg_featureserv GitHub Repository & Releases: https://github.com/CrunchyData/pg_featureserv
- Official PostGIS Project Portal: https://postgis.net/

4. Step-by-Step Installation Guide
- Check PostgreSQL / PostGIS & OS Requirements: Confirm you have a running `PostgreSQL` instance with the `PostGIS` extension enabled, and a Linux, Windows, macOS, or Docker host to run `pg_featureserv`.
- Download the Official Binary or Pull the Docker Image: Download the precompiled binary for your OS from `https://github.com/CrunchyData/pg_featureserv/releases`—or pull the official container image (`docker pull pramsey/pg_featureserv:latest`).
- Configure Your Database Connection (`DATABASE_URL`): Set the environment variable `DATABASE_URL="postgres://user:password@localhost:5432/your_gis_db"` (or configure `pg_featureserv.toml`).
- Start the Service & Verify the Web Interface: Run `./pg_featureserv` in your terminal and open `http://localhost:9000` in your browser to inspect your published PostGIS feature collections and interactive map previews.
<Image src="image_agent_tag_10370938517728324350" alt="PostgreSQL and PostGIS database installation wizard setup dialog" caption="PostgreSQL and PostGIS backend setup" />
5. How to Use pg_featureserv: Beginner Workflow
- Prepare Spatial Tables with Primary Keys & Geometry Columns in PostGIS: Ensure your PostGIS tables have a primary key (`SERIAL` or `UUID`), a registered geometry column with a valid `SRID` (such as `EPSG:4326`), and a `GIST` spatial index.
- Launch `pg_featureserv` Pointed at Your PostGIS Database: Start `pg_featureserv` with your `DATABASE_URL` and check `/collections.json` or the web UI to verify your spatial layers appear automatically.
- Filter & Query GeoJSON Features via URL Parameters: Test bounding-box (`?bbox=...`), attribute filtering (`?filter=...`), and property limiting (`?properties=name,type`) directly in your browser or REST client.
- Expose a Custom Spatial Function in `postgisftw` Schema: Create a PostgreSQL function inside `CREATE SCHEMA postgisftw;` returning `SETOF` rows with a geometry column—`pg_featureserv` immediately publishes it under `/functions/`.
- Connect `QGIS` or Your Web Map (`Leaflet` / `MapLibre` / `OpenLayers`): Add `http://localhost:9000` as an `OGC API - Features` connection in `QGIS` (or fetch `.json` GeoJSON URLs in JavaScript) to render live PostGIS data.
6. Frequently Asked Questions (FAQ)
- How does `pg_featureserv` differ from `pg_tileserv`?`pg_featureserv` serves vector features as `GeoJSON` and `JSON` via the `OGC API - Features` standard (ideal for querying, editing, and smaller/filtered datasets), whereas `pg_tileserv` serves binary `Mapbox Vector Tiles (MVT)` for high-speed rendering of massive datasets.
- Can I connect `pg_featureserv` directly to QGIS Desktop?Yes. In QGIS, open `Data Source Manager > WFS / OGC API - Features`, create a new connection using your `pg_featureserv` base URL, and load PostGIS layers straight onto your map canvas.
- Is `pg_featureserv` free for commercial and production deployments?Yes. `pg_featureserv` is open-source software licensed under `Apache-2.0`.