Pygeoapi (an official OSGeo Project developed by the pygeoapi open-source community for Linux, Windows, and macOS) is a modern Python server implementation of the OGC API suite of standards. Built for GIS backend engineers, spatial data infrastructure (SDI) architects, government geoportal teams, and Python developers, pygeoapi publishes vector datasets, raster coverages, vector/raster tiles, maps, and metadata catalogs over clean RESTful JSON, GeoJSON, and HTML interfaces—connecting seamlessly to PostGIS, GeoPackage, GDAL/OGR, Elasticsearch, STAC catalogs, and cloud object storage.
1. In-Depth Review: Why Geospatial Backend & SDI Teams Choose pygeoapi
- Modern RESTful OGC API Compliance with Interactive OpenAPI / Swagger UI: Replaces legacy XML-heavy WFS/WMS/WCS workflows with modern JSON/GeoJSON REST endpoints (`OGC API - Features`, `Tiles`, `Coverages`, `Records`, `Processes`, `Environmental Data Retrieval`, and `Maps`) complete with built-in HTML browsing and OpenAPI documentation.
- Pluggable Data Providers Without Mandatory Database Migration: Publishes spatial data directly from `PostgreSQL/PostGIS`, `GeoPackage`, `GeoJSON`, `CSV`, `GDAL/OGR` sources, `Parquet/GeoParquet`, `Elasticsearch`, and `xarray`/`Zarr` multidimensional arrays via a single YAML configuration file.
- Lightweight Python Deployment & Official Docker Images: Deploys effortlessly via `pip`, `conda`, or official Docker containers behind Nginx/Gunicorn, Uvicorn, or Starlette/Flask—scaling smoothly from local developer laptops to national spatial data infrastructures.
2. Key Features & Capabilities
- Multi-Standard OGC API Implementation: Serve `OGC API - Features` (Part 1–4 transactions & filtering), `Tiles`, `Coverages`, `Maps`, `Records` (STAC/catalog), `Processes`, and `EDR` from one server.
- Broad Backend Provider Ecosystem: Connect to `PostGIS`, `GeoPackage`, `OGR`, `GeoParquet`, `Elasticsearch`, `TinyDB`, `xarray`, and `Rasterio` without writing custom glue code.
- Built-In HTML Web Interface & Schema.org SEO Markup: Every collection, feature item, and tile matrix renders both machine-readable GeoJSON/JSON and human-friendly interactive web maps (`Leaflet`).
- CQL2 Filtering, CRS Transformation & Pagination: Query datasets using Common Query Language (`CQL2`), bounding boxes (`bbox`), datetime ranges, and on-the-fly coordinate reference system (`CRS`) reprojection.
- Custom Python Processing Plugins (`OGC API - Processes`): Expose custom geospatial Python scripts (buffer, spatial join, raster stats) as standardized REST processing endpoints.
- 100% Free & Open-Source (`MIT` License): Backed by OSGeo with zero licensing costs, commercial restrictions, or vendor lock-in.
- Official Links: Free Download, Documentation & Source Code
Always install pygeoapi and consult configuration schemas directly from official OSGeo and pygeoapi portals:
- Official pygeoapi Website & OSGeo Project Portal: https://pygeoapi.io/
- Official pygeoapi Documentation & Configuration Guide: https://docs.pygeoapi.io/
- Official pygeoapi GitHub Repository & Releases: https://github.com/geopython/pygeoapi
- Official pygeoapi Docker Hub Images: https://hub.docker.com/r/geopython/pygeoapi
4. Step-by-Step Installation Guide
- Check Python or Docker Prerequisites: Confirm your server or workstation has `Python 3.10+` (with `pip` or `conda`) or `Docker Engine` installed on Linux, macOS, or Windows.
- Install pygeoapi via `pip` (or Pull Official Docker Image): Run `python3 -m venv pygeoapi-env && source pygeoapi-env/bin/activate && pip install pygeoapi` (or pull `docker pull geopython/pygeoapi:latest` for containerized deployment).
- Generate & Customize Your YAML Configuration: Copy the sample configuration (`cp pygeoapi-config.yml local.config.yml`), define your server metadata, and configure a resource pointing to your `GeoPackage`, `GeoJSON`, or `PostGIS` table.
- Generate the OpenAPI Document & Start the Server: Run `export PYGEOAPI_CONFIG=local.config.yml`, `export PYGEOAPI_OPENAPI=local.openapi.yml`, execute `pygeoapi openapi generate $PYGEOAPI_CONFIG --output-file $PYGEOAPI_OPENAPI`, and launch `pygeoapi serve` (accessible at `http://localhost:5000`).
5. How to Use pygeoapi: Beginner Workflow
- Prepare a Spatial Dataset (`GeoPackage` or `PostGIS`): Place a clean vector dataset (such as `parcels.gpkg` or a `PostGIS` table with a spatial index) in your data directory.
- Register the Collection in `local.config.yml`: Add a new entry under `resources:` specifying `type: collection`, `title`, `keywords`, spatial/temporal `extents`, and `providers:` (`name: OGR` or `PostgreSQL`, `data: /path/to/parcels.gpkg`).
- Regenerate the OpenAPI Specification: Run `pygeoapi openapi generate $PYGEOAPI_CONFIG --output-file $PYGEOAPI_OPENAPI` whenever you add or update collections in your YAML config.
- Browse Collections & Interactive Maps in Your Browser: Open `http://localhost:5000/collections`, click your dataset to preview features on the built-in interactive web map, and inspect attribute properties.
- Consume REST GeoJSON Endpoints in QGIS or Web Apps: Append `?f=json` to any collection URL (`http://localhost:5000/collections/parcels/items?f=json&limit=100`) to load live OGC API Features directly into QGIS, Leaflet, MapLibre GL, or Python scripts.
6. Frequently Asked Questions (FAQ)
- Is pygeoapi free for commercial and government geoportals?Yes. pygeoapi is an official OSGeo project released under the permissive `MIT` open-source license, allowing unrestricted commercial, government, and academic deployment.
- How does pygeoapi differ from GeoServer?GeoServer is a Java-based enterprise server focused heavily on traditional OGC web services (`WMS`, `WFS`, `WCS`) with a GUI admin panel, whereas pygeoapi is a lightweight Python microservice built natively around modern JSON/REST `OGC API` standards and YAML configuration.
- Can QGIS connect directly to a pygeoapi server?Yes. QGIS 3 includes native `OGC API - Features` and `Vector Tiles` support—simply add your pygeoapi base URL under `WFS / OGC API - Features` in the QGIS Data Source Manager.