pg_featureserv

A lightweight RESTful geospatial feature server for PostGIS, written in Go.
It supports the OGC API - Features REST API standard.
Features
- Implements the OGC API - Features standard.
- Supports standard request parameters
limit, bbox
- Extended parameters include
offset, properties, orderBy, transform, precision
- Data reponses are formatted in JSON and GeoJSON
- Provides a simple HTML user interface, with web maps to view spatial data
- Uses the power of PostgreSQL to reduce the amount of code
and to make data definition easy and familiar.
- Feature collections are defined by database objects (tables and views)
- Uses PostGIS to provide geospatial functionality:
- Transforming geometry data into the output coordinate system
- Marshalling feature data into GeoJSON
- Full-featured HTTP support
- CORS support with configurable Allowed Origins
- GZIP response encoding
Download
Builds of the latest code:
Building from Source
pg_featurserv is developed under Go 1.13. It may also work with earlier versions.
- Ensure the Go compiler is installed
- Download or clone this repository into
$GOPATH/src/github.com/CrunchyData/pg_featureserv
- To build the executable, run the following commands:
cd $GOPATH/src/github.com/CrunchyData/pg_featureserv/
go build
- This should create a
pg_featureserv executable in the application directory
Configuring the service
- Set the environment variable
DATABASE_URL with a Postgres connection string
- Example:
export DATABASE_URL="host=localhost"
- Edit the configuration file
config.toml, located in the application directory
Running the service
- If not already done, move to the application directory:
cd $GOPATH/src/github.com/CrunchyData/pg_featureserv
- Start the server:
- Open the service home page in a browser:
http:/localhost:9000/home.html
Command-line options
-? - show command usage
--config file.toml - specify configuaration file to use
--debug - set logging level to TRACE (can also be set in config file)
--devel - run in development mode (e.g. HTML templates reloaded every query)
--test - run in test mode, with an internal catalog of tables and data
Requests Overview
Features are identified by a collection name and feature id pair.
The default response is in JSON/GeoJSON format.
Append .html to the request path to see the UI page for the resource.
The example requests assume that the service is running locally and configured
to listen on port 9000.
See API Summary for a summary of the API.