{"id":19236826,"url":"https://github.com/crunchydata/pg_featureserv","last_synced_at":"2025-05-15T13:07:27.950Z","repository":{"id":40889944,"uuid":"225945089","full_name":"CrunchyData/pg_featureserv","owner":"CrunchyData","description":"Lightweight RESTful Geospatial Feature Server for PostGIS in Go","archived":false,"fork":false,"pushed_at":"2025-04-14T19:18:31.000Z","size":2521,"stargazers_count":489,"open_issues_count":54,"forks_count":92,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-05-15T13:07:26.795Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CrunchyData.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-12-04T19:50:14.000Z","updated_at":"2025-05-14T13:04:10.000Z","dependencies_parsed_at":"2023-10-10T23:10:54.371Z","dependency_job_id":"7cf45870-c974-499c-9f2b-4c727408ba1b","html_url":"https://github.com/CrunchyData/pg_featureserv","commit_stats":{"total_commits":547,"total_committers":21,"mean_commits":"26.047619047619047","dds":"0.10237659963436929","last_synced_commit":"e756240e0edecec51b11a410626be0f9bfa74677"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrunchyData%2Fpg_featureserv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrunchyData%2Fpg_featureserv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrunchyData%2Fpg_featureserv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CrunchyData%2Fpg_featureserv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CrunchyData","download_url":"https://codeload.github.com/CrunchyData/pg_featureserv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346624,"owners_count":22055808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T16:23:30.199Z","updated_at":"2025-05-15T13:07:27.886Z","avatar_url":"https://github.com/CrunchyData.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://access.crunchydata.com/documentation/pg_featureserv/latest/\"\u003e\u003cimg width=\"180\" height=\"180\" src=\"./hugo/static/crunchy-spatial-logo.png?raw=true\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# pg_featureserv\n\n[![.github/workflows/ci.yml](https://github.com/CrunchyData/pg_featureserv/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/CrunchyData/pg_featureserv/actions/workflows/ci.yml)\n\nA lightweight RESTful geospatial feature server for [PostGIS](https://postgis.net/), written in [Go](https://golang.org/).\nIt supports the [*OGC API - Features*](https://ogcapi.ogc.org/features/) REST API standard.\n\nSee also our companion project [`pg_tileserv`](https://github.com/CrunchyData/pg_tileserv).\n\n## Features\n\n* Implements the [*OGC API - Features*](https://ogcapi.ogc.org/features/) standard.\n  * Standard query parameters: `limit`, `bbox`, `bbox-crs`, property filtering, `sortby`, `crs`\n  * Query parameters `filter` and `filter-crs` allow [CQL filtering](https://portal.ogc.org/files/96288), with spatial support\n  * Extended query parameters: `offset`, `properties`, `transform`, `precision`, `groupby`\n* Data responses are formatted in JSON and [GeoJSON](https://www.rfc-editor.org/rfc/rfc7946.txt)\n* Provides a simple HTML user interface, with web maps to view spatial data\n* Uses the power of PostgreSQL to reduce the amount of code\n  and to make data definition easy and familiar.\n  * Feature collections are defined by database objects (tables and views)\n  * Filters are executed in the database, and use indexes where defined\n* Uses PostGIS to provide geospatial functionality:\n  * Spatial filtering\n  * Transforming geometry data into the output coordinate system\n  * Marshalling feature data into GeoJSON\n* Full-featured HTTP support\n  * CORS support with configurable Allowed Origins\n  * GZIP response encoding\n  * HTTP and HTTPS support\n\nFor a full list of software capabilities see [FEATURES](FEATURES.md).\n\n## Documentation\n\n* [User Guide](https://access.crunchydata.com/documentation/pg_featureserv/latest/)\n* [FEATURES](FEATURES.md) - full list of software capabilities\n* [API](API.md) - summary of the web service API\n\n### Relevant Standards\n\n* [*OGC API - Features - Part 1: Core*](http://docs.ogc.org/is/17-069r3/17-069r3.html)\n* [*OGC API - Features - Part 2: Coordinate Reference Systems by Reference*](https://docs.ogc.org/is/18-058/18-058.html)\n* [**DRAFT** *OGC API - Features - Part 3: Filtering*](http://docs.ogc.org/DRAFTS/19-079r1.html)\n* [**DRAFT** *Common Query Language (CQL2)*](https://docs.ogc.org/DRAFTS/21-065.html)\n* [*GeoJSON*](https://www.rfc-editor.org/rfc/rfc7946.txt)\n\n## Download\n\nBuilds of the latest code:\n\n* [Linux](https://postgisftw.s3.amazonaws.com/pg_featureserv_latest_linux.zip)\n* [Windows](https://postgisftw.s3.amazonaws.com/pg_featureserv_latest_windows.zip)\n* [MacOS](https://postgisftw.s3.amazonaws.com/pg_featureserv_latest_macos.zip)\n* [Docker](https://hub.docker.com/r/pramsey/pg_featureserv)\n\n\n## Build from Source\n\n`pg_featureserv` is developed under Go 1.13.  It may also work with earlier versions.\n\nIn the following, replace version `\u003cVERSION\u003e` with the `pg_featureserv` version are building against.\n\n### Without a Go environment\n\nWithout `go` installed, you can build `pg_featureserv` in a docker image:\n\n* Download or clone this repository into `$GOPATH/src/github.com/CrunchyData/pg_featureserv`\n* Run the following command in `pg_featureserv/`:\n  ```bash\n  make APPVERSION=\u003cVERSION\u003e clean build-in-docker\n  ```\n\n### In Go environment\n\n* Download or clone this repository into `$GOPATH/src/github.com/CrunchyData/pg_featureserv`\n* To build the executable, run the following commands:\n  ```bash\n  cd $GOPATH/src/github.com/CrunchyData/pg_featureserv/\n  go build\n  ```\n\n* This creates a `pg_featureserv` executable in the application directory\n* (Optional) Run the unit tests using `go test ./...`\n\n### Docker image of `pg_featureserv`\n\n#### Build the image\n\n```bash\nmake APPVERSION=\u003cVERSION\u003e clean docker\n```\n\n#### Run the image\n\nTo run using an image built above:\n\n```bash\ndocker run --rm -dt -e DATABASE_URL=postgres://user:pass@host/dbname -p 9000:9000 pramsey/pg_featureserv:\u003cVERSION\u003e\n```\n\n## Configure the service\n\nThe [configuration file](config/pg_featureserv.toml.example) is automatically read from the following locations, if it exists:\n\n* In the system configuration directory, at `/etc/pg_featureserv.toml`\n* Relative to the directory from which the program is run, `./config/pg_featureserv.toml`\n* In a root volume at `/config/pg_featureserv.toml`\n\nTo specify a configuration file directly use the `--config` commandline parameter.\nIn this case configuration files in other locations are ignored.\n\n### Configuration Using Environment Variables\n\nTo set the database connection the environment variable `DATABASE_URL`\ncan be used with a\nPostgres [connection string](https://www.postgresql.org/docs/12/libpq-connect.html#LIBPQ-CONNSTRING):\n```bash\nexport DATABASE_URL=\"host=localhost user=postgres\"\n```\n\nOther parameters in the configuration file can be over-ridden in the environment.\nPrepend the upper-cased parameter name with `PGFS_section_` to set the value.\nFor example, to change the HTTP port, function schemas, and service title:\n```bash\nexport PGFS_SERVER_HTTPPORT=8889\nexport PGFS_DATABASE_FUNCTIONINCLUDES=\"postgisftw,my_funs\"\nexport PGFS_METADATA_TITLE=\"My PGFS\"\n```\n\n### SSL\nFor SSL support, a server **private key** and an **authority certificate** are needed.\nFor testing purposes you can generate a **self-signed key/cert pair** using `openssl`:\n```bash\nopenssl req  -nodes -new -x509  -keyout server.key -out server.crt\n```\nThese are set in the configuration file:\n```\nTlsServerCertificateFile = \"/path/server.crt\"\nTlsServerPrivateKeyFile = \"/path/server.key\"\n```\n\n## Run the service\n\n* Change to the application directory:\n  * `cd $GOPATH/src/github.com/CrunchyData/pg_featureserv`\n* Start the server:\n  * `./pg_featureserv`\n* Open the service home page in a browser:\n  * `http:/localhost:9000/home.html`\n\n### Command-line options\n\n* `-?` - show command usage\n* `--config file.toml` - specify configuration file to use\n* `--debug` - set logging level to TRACE (can also be set in config file)\n* `--devel` - run in development mode (e.g. HTML templates reloaded every query)\n* `--test` - run in test mode, with an internal catalog of tables and data\n* `--version` - display the version number\n\n## Troubleshooting\n\nTo get detailed information about service operation\nrun with the `--debug` commandline parameter.\n```sh\n./pg_featureserv --debug\n```\nDebugging can also be enabled via the configuration file (`Server.Debug=true`),\nor in the environment:\n```sh\nexport PGFS_SERVER_DEBUG=true\n ```\n\n## Requests Overview\n\nFeatures are identified by a _collection name_ and _feature id_ pair.\n\nThe default response is in JSON/GeoJSON format.\nAppend `.html` to the request path to see the UI page for the resource.\nIn a web browser, to request a JSON response append `.json` to the path (which overrides the browser `Accept` header).\n\nThe example requests assume that the service is running locally and configured\nto listen on port 9000.\n\n- Landing page (HTML or JSON): http://localhost:9000/\n- Landing page (HTML): http://localhost:9000/index.html\n- Landing page (JSON): http://localhost:9000/index.json\n- OpenAPI definition: http://localhost:9000/api\n- OpenAPI test UI: http://localhost:9000/api.html\n- Conformance: http://localhost:9000/conformance\n- Collections: http://localhost:9000/collections\n- Collections UI: http://localhost:9000/collections.html\n- Feature collection metadata: http://localhost:9000/collections/{name}\n- Feature collection UI: http://localhost:9000/collections/{name}.html\n- Features from a single feature collection: http://localhost:9000/collections/{name}/items\n- Features from a single feature collection (Map UI): http://localhost:9000/collections/{name}/items.html\n- Single feature from a feature collection: http://localhost:9000/collections/{name}/items/{featureid}\n- Functions (JSON): http://localhost:9000/functions\n- Functions UI: http://localhost:9000/functions.html\n- Function metadata: http://localhost:9000/functions/{name}\n- Function UI: http://localhost:9000/functions/{name}.html\n- Features from a function (JSON): http://localhost:9000/functions/{name}/items\n- Features from a function (Map UI): http://localhost:9000/functions/{name}/items.html\n\nSee [API Summary](API.md) for a summary of the web service API.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrunchydata%2Fpg_featureserv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrunchydata%2Fpg_featureserv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrunchydata%2Fpg_featureserv/lists"}