While modern clients are shifting towards OGC API and STAC, a vast ecosystem of established desktop GIS clients (e.g., QGIS, ArcGIS, etc.) rely on the OGC Web Feature Service (WFS) standard. The wfs extension serves as a critical legacy bridge to this ecosystem, ensuring that data is accessible natively.
The WFS 2.0 standard requires Key-Value Pair (KVP) queries spanning Capabilities, FeatureTypes, and raw GetFeature queries.
We implement dual routing to bridge this RESTfully:
GET /wfs: Root global query (Discovers everything)GET /wfs/{catalog_id}: Scoped isolating a tenant into a specific virtual endpoint.
We utilize xml.etree.ElementTree to synthesize XSD architectures directly dynamically at request time strictly bypassing physical static schema maps.
Because we lean heavily on JSONB parameter mappings, classical strongly typed schemas don't exist natively.
- The engine checks standard fixed properties resolving SQL types (
valid_from->dateTime). - It fetches single row snapshots evaluating JSON structures generating derived types for flexible attributes.
- Outputs dynamically generated
xsd:schemalogic to satisfy rigid GIS platforms.
Executing GetFeature XML creation natively is notoriously CPU expensive.
We sidestep this utilizing raw C-level PostGIS architecture.
Instead of extracting WKB geometry out of the database and marshaling it, the SQL explicitly commands ST_AsGML(geom).
- Database handles memory limits rendering text directly.
- The core python returns strings mapping them linearly directly into the larger wrapper text payload minimizing all marshalling boundaries resulting in a significantly faster endpoint.