pygeoapi logo

Additions to pygeoapi for Geonovum Tender

CRS and INSPIRE support - (Dutch) API Design Rules

OSGeo Project

Amersfoort, April 20, 2023

This presentation available at

The tender doc is available at geonovum-tender-doc.pdf

Table of contents

  • About pygeoapi
  • Adding CRS support ("OAPIF Part 2")
  • INSPIRE improvements
  • Adherence to (Dutch) API Design rules

About pygeoapi

Project overview

Project Overview

  • Geospatial data Web API framework via OGC API
  • REST/JSON/OpenAPI/Swagger
  • OGC Compliant
  • OSGeo Project
  • International team (Canada, Netherlands, Greece, Italy, New Zealand, United States, Spain)
    • Numerous core contributors
    • 21000 upstream contributors (dependencies)

Data Publishing

Leave data as-is

  • Fits to the data (not the inverse)
  • Proxy/wrap remote legacy services:
    WFS, ESRI FS, WMS,...

New: leave projection as-is
(CRS support!)

Technical Overview

  • Web framework agnostic (default Flask)
  • YAML configuration
  • OpenAPI document generation
  • Plugin framework (data connectors, formats, ...)
  • Easy deploy (pip, Docker, UbuntuGIS)
  • Minimal dependencies

Feature Data Providers

Elasticsearch PostGIS CSV Spatialite GeoJSON...

Feature Data Providers - GDAL/OGR

  • Via OGR-Python bindings
  • Unleashes ~100 Vector Formats! (WFS v1/v2, GeoPackage, Shapefile, GeoJSON, PostGIS, ...)
  • Paging, reprojection, spatial/attribute query
  • Unlock existing WFS v1/v2s, even ESRI FS!

Other OGC APIs

in various stages of development

  • Coverage - NetCDF, Cloud Optimized GeoTIFF, ...
  • Tiles - minio, ZXY, ...
  • Maps - MapServer/MapScript, WMS Facade, ...
  • Records (Metadata) - Elasticsearch, TinyDB, ...
  • Processing - Python workflow, TinyDB, ...

Implement your own Plugin

as Feature Data, Process, ... Provider

Adding CRS Support

OGC API - Features - Part 2:
Coordinate Reference Systems by Reference


  • metadata: CRS list and storageCRS
  • parameter: CRS bounding box
  • parameter: CRS
  • HTTP response header: Content-CRS
  • documentation

YAML Config for CRS

  type: collection
  title: Dutch INSPIRE Addresses - RD
	- type: feature
	  name: OGR
	    source_type: GPKG
	    source: data/ADNL_28992.gpkg

CRS Support - Implementation

  • available for ALL Feature Providers
  • Per Feature Provider
    • handle internally (OGR, PostGIS) OR
    • delegate to pygeoapi core (e.g. CSV)
      via Python Decorator @crs_transform
  • CITE Test Compliance

Development Aspects

INSPIRE improvements


  • Collection link(s) to data license
  • Collection link(s) to "description of encoding"
  • Collection link(s) for bulk downloads

Development (1/2)

  • Mostly about configuration: pygeoapi collection links

Development (2/2)

  • Created UrlPrefetcher to get content details of enclosure links (HEAD request)
  • Note: response may not contain Content-Type or
    Content-Length headers
  • Added to core via PR 1173
  • Documentation

Adherence to (Dutch) API Design Rules


  • API-03: Apply standard HTTP methods
  • API-16: Provide OpenAPI Specification
  • API-20: Include major version number in URI
  • API-48: Leave off trailing slashes from URIs
  • API-51: OAS at a standard location as JSON
  • API-56: Adhere to Semantic Versioning model
  • API-57: Full version number in response header

Development (1/2)

  • OAS doc proofed crucial: embedded some components
  • API-20 / API-48:
    • implement at router or app level?
    • implemented for Flask, Starlette, and Django
    • landing page rule conflict!
  • API-56:
    • semantic versioning for API software or schema?
    • currently software versioning only

Development (2/2)

  • Added a lot of unit tests
  • ADR is fully configurable (inactive by default)
  • Added to core via PR 1152
  • Documentation

Dutch ADR validator

ADR validator result


Thank you!

Just van den Broecke - Just Objects - @justb4

Sander Schaminee - GeoCat @geosander