gws.base.ows.server

OWS services.

Base for WMS, WMTS and WFS services.

Configuration

A service (owsService) can be global or project-bound. A global service can be used with any project.

When invoked, the service locates the project (the bound project or projectUid for global services) and collects all suitable layers from the project.

Layers can control their presence in OWS services using withOws and ows configs.

The ows action is required to serve OWS services over http.

XML Namespaces

A WFS service requires each involved layer to have a configured XML namespace (with ows.featureName <ns>:name or ows.xmls <ns>). Additionally, custom namespaces must be configured globally using Application.xml config.

For some layers, we can autogenerate schemas for custom namespaces on the fly from the layer data. To use an autogenerated schema, the schemaLocation attribute for a namespace must be https://<server>/_/owsXml/namespace/<ns>.xsd and the ows action must be enabled globally.

Workflow

  • the ows action receives a request and locates the Service object and the corresponding Project

  • the service initializes the Request (gws.base.ows.server.request.Object)

  • a tree of LayerCaps (gws.base.ows.server.core.LayerCaps) is created (or loaded from the cache)

  • the service filters the caps tree according to the parameters like LAYERS or TYPENAMES and creates a list of suitable leaf layers

  • for image requests, like GetMap, the leaves are rendered, the result is converted to the requested image format and returned

  • for search requests, the service searches the leaves and creates FeatureCollection` objects

  • for search and capabilities requests, a suitable template is located and rendered

Formats

Standard service templates are python templates which use gws.lib.xmlx.tag() to generate nested XML responses.

Standard image formats are image/png and image/jpeg.

Users can configure their own templates and image formats. The “supported formats” lists in OWS capabilities documents are created automatically, based on configured templates and image formats.

References

OGC Standards:

Other implementations:

Source code: gws.base.ows.server

Submodules

Package Contents

class gws.base.ows.server.FeatureCollection(*args, **kwargs)

Bases: gws.Data

Feature Collection.

members: list[FeatureCollectionMember]
numMatched: int
numReturned: int
timestamp: str
values: list
class gws.base.ows.server.FeatureCollectionMember(*args, **kwargs)

Bases: gws.Data

A member of a Feature Collection.

feature: gws.Feature
layer: gws.Layer | None
layerCaps: LayerCaps | None
class gws.base.ows.server.LayerCaps(*args, **kwargs)

Bases: gws.Data

Layer wrapper object.

A LayerCaps object wraps a Layer object and provides additional data needed to represent a layer in an OWS service.

bounds: list[gws.Bounds]
children: list[LayerCaps]
featureName: str
featureNameQ: str
geometryName: str
geometryNameQ: str
hasLegend: bool
isGroup: bool
isSearchable: bool
layer: gws.Layer
layerName: str
layerNameQ: str
leaves: list[LayerCaps]
maxScale: int
minScale: int
model: gws.Model | None
title: str
xmlNamespace: gws.XmlNamespace | None
class gws.base.ows.server.TemplateArgs(*args, **kwargs)

Bases: gws.TemplateArgs

Arguments for service templates.

featureCollection: gws.base.ows.server.core.FeatureCollection
gmlVersion: int
intVersion: int
layerCapsList: list[gws.base.ows.server.core.LayerCaps]
service: gws.OwsService
serviceUrl: str
sr: Object
tileMatrixSets: list[gws.TileMatrixSet]
url_for: Callable
version: str