Overriding Server Logic

There are a few places where the server logic can be overwritten:

There are a few places that allow to customize the WFS logic:

View Layer

The following methods of the WFSView can be overwritten:

The permission checks can access the self.request.user object in Django, and inspect the fully parsed WFS request in self.request.ows_request.

Feature Layer

Overriding FeatureType allows to change how particular features and fields are exposed. It can also override the internal XML Schema Definition (XSD) that all output and query filters read.

This can also adjust the

  • Overriding check_permissions() allows to perform a permission check before the feature can be read (e.g. a login role check).

  • Overriding get_queryset() allows to define the queryset per request.

  • Overriding xsd_type constructs the internal XSD definition of this feature.

  • Overriding xsd_type_class defines which class constructs the XSD.

The field() function returns a FeatureField. Instances of this class can be passed directly to the FeatureType(fields=...) parameter, and override these attributes:

XSD Layer

The feature fields generate an internal XML Schema Definition (XSD) that defines how properties are read, and where the underlying ORM field/relation can be found. These types can be overwritten for custom behavior, and then be returned by custom FeatureType and FeatureField objects.

  • XsdComplexType defines a complete class with elements and attributes.

  • XsdElement defines a property that becomes a normal element.

  • XsdAttribute defines the attributes (only gml:id is currently rendered).

The elements and attributes have the following fields:

Request Parsing

The classes in gisserver.parsers.wfs20 translate the XML POST request into an internal representation of the request. Each class closely mirrors the definitions in the WFS 2.0 specification. The GET request parsing (KVP format) is a special case of these classes.

New parser classes may be added for operations that are not implemented yet (such as WFS-T or creating stored queries). Subsequently, a WFSOperation needs to be implemented that handles this request. That operation needs to be registered in WFSView’s accept_operations attribute. The WFSOperation may also define a parser_class to override which parser handles the request.