gisserver.extensions.functions module¶
Functions to be callable from query filters.
By using the function_registry, custom stored functions can be registered in this server.
These are called by the filter queries using the Function element.
Out of the box, various built-in functions are present.
Built-in options are documented in Using Functions.
Most of the out-of-the box options are inspired by GeoServer. Functions which already have a fes-syntax equivalent have been are omitted.
- class gisserver.extensions.functions.FesFunction(name: str, body: Func | Callable[[...], Func], arguments: dict[str, XsdTypes] | None = None, returns: XsdTypes | None = None)¶
Bases:
objectA registered database function that can be used by
<fes:Function name="...">.The
Functionclass will resolve these registered functions by name, and callbuild_query()to include them in the database query. This will actually insert a Django ORM function in the query!This wrapper class also provides the metadata and type descriptions of the function, which is exposed in the
GetCapabilitiescall.- __init__(name: str, body: Func | Callable[[...], Func], arguments: dict[str, XsdTypes] | None = None, returns: XsdTypes | None = None) None¶
- build_query(*expressions: Combinable | Q) Func¶
Build the query expression for the function.
- class gisserver.extensions.functions.FesFunctionRegistry¶
Bases:
objectRegistry of functions to be callable by
<fes:Function>.The registered functions should be capable of running an SQL function.
- __init__()¶
- register(name=None, body: Func | Callable[[...], Func] | None = None, *, arguments: dict[str, XsdTypes] | None = None, returns: XsdTypes | None = None)¶
Decorator to register a function.
It’s not recommended to register the Django Func objects directly, as the parameters are passed on from the client-side. Instead, create a wrapper function that enforces a controlled set of parameters.
- resolve_function(function_name) FesFunction¶
Resole the function using its name.
- gisserver.extensions.functions.function_registry = <gisserver.extensions.functions.FesFunctionRegistry object>¶
The function registry