gisserver.views module¶
The view layer parses the request, and dispatches it to an operation.
- class gisserver.views.OWSView(**kwargs)¶
Bases:
ViewThe base logic to implement OGC view like WFS.
Each subclass defines ‘accept_operations’ with the desired RPC operations.
- accept_operations = {}¶
Internal configuration of all available RPC calls.
- accept_versions = ('2.0.0',)¶
Supported versions
- call_operation(wfs_operation_cls: type[WFSOperation])¶
Call the resolved method.
- default_service = None¶
Allow to set a default service, so the SERVICE parameter can be omitted.
- dispatch(request, *args, **kwargs)¶
Render proper XML errors for exceptions on all request types.
- get(request, *args, **kwargs)¶
Entry point to handle HTTP GET requests.
This parses the ‘SERVICE’ and ‘REQUEST’ parameters, to call the proper
WFSOperation.All query parameters are handled as case-insensitive.
- get_index_context_data(service: str | None = None, **kwargs)¶
Provide the context data for the index page.
- get_index_template_names(service: str | None = None)¶
Get the index page template name. If no template is configured, some reasonable defaults are selected.
- get_operation_class(service: str, request: str) type[WFSOperation]¶
Resolve the method that the client wants to call.
- get_service_description(service: str | None = None) ServiceDescription¶
Provide the (dynamically generated) service description.
- classmethod get_xml_namespace_aliases() dict[str, str]¶
Provide all namespaces aliases with a namespace. This is most useful for parsing input. The default is:
{"app": cls.xml_namespace}.
- classmethod get_xml_namespaces_to_prefixes() dict[str, str]¶
Provide a mapping from namespace to prefix. This is most useful for rendering output. The default is:
{cls.xml_namespace: "app"}.
- handle_exception(exc)¶
Transform an exception into a OGC response. When nothing is returned, the exception is raised instead.
- index_template_name = None¶
Template to render an HTML welcome page for non-OGC requests.
- is_index_request()¶
Tell whether to index page should be shown.
- ows_request: BaseOwsRequest = None¶
The OWS request, which contains the complete parsed request.
- post(request, *args, **kwargs)¶
Entry point to handle HTTP POST requests.
This parses the XML to get the correct service and operation, to call the proper
WFSOperation.
- property server_url¶
Expose the server URLs for all operations to read.
- service_description: ServiceDescription | None = None¶
Metadata of the service:
- use_html_templates = True¶
Whether to render GET HTML pages
- version = '2.0.0'¶
Default version to use
- xml_namespace = 'http://example.org/gisserver'¶
Define the namespace to use in the XML
- xml_namespace_aliases = None¶
Define namespace aliases to use, default is
{"app": self.xml_namespace}.
- class gisserver.views.WFSView(**kwargs)¶
Bases:
OWSViewA view for a single WFS server.
This view exposes multiple dataset, each containing a single Django model (mapped to feature types in WFS).
This class can be used by subclassing it, and redefining
feature_typesorget_feature_types().- accept_operations = {'WFS': {'DescribeFeatureType': <class 'gisserver.operations.wfs20.DescribeFeatureType'>, 'DescribeStoredQueries': <class 'gisserver.operations.wfs20.DescribeStoredQueries'>, 'GetCapabilities': <class 'gisserver.operations.wfs20.GetCapabilities'>, 'GetFeature': <class 'gisserver.operations.wfs20.GetFeature'>, 'GetPropertyValue': <class 'gisserver.operations.wfs20.GetPropertyValue'>, 'ListStoredQueries': <class 'gisserver.operations.wfs20.ListStoredQueries'>}}¶
Internal configuration of all available RPC calls.
- check_permissions(feature_type: FeatureType)¶
Hook that allows subclasses to reject access for datasets. It may raise a Django PermissionDenied error.
This can access:
self.request(the Django HTTPRequest) andself.ows_request. The latter contains a parsed request object from thegisserver.parsers.wfs20package, such as the parsedGetFeatureorGetPropertyValuerequest.
- default_service = 'WFS'¶
Since URLs to this view are already specifically for WFS, allow to omit the service name.
- feature_types: list[FeatureType] = []¶
Define the features (=tables) in this dataset. For dynamic per-request logic, consider overwriting
get_feature_types()instead.
- get_bound_feature_types() list[FeatureType]¶
Internal logic wrapping the FeatureType definitions provided by the developer. This binds the XML namespace information from this view to the declared types.
- get_feature_types() list[FeatureType]¶
Return all available feature types this server exposes.
This method may be overwritten to provide feature types dynamically, for example to give them different elements based on user permissions.
- get_xml_schema_url(feature_types: list[FeatureType]) str¶
Return the XML schema URL for the given feature types. This is used in the GML output rendering.
- max_page_size = 5000¶
Maximum number of features to return
- wfs_filter_capabilities = {'ImplementsAdHocQuery': True, 'ImplementsExtendedOperators': False, 'ImplementsFunctions': True, 'ImplementsMinSpatialFilter': True, 'ImplementsMinStandardFilter': True, 'ImplementsMinTemporalFilter': False, 'ImplementsMinimumXPath': True, 'ImplementsQuery': True, 'ImplementsResourceId': True, 'ImplementsSchemaElementFunc': False, 'ImplementsSorting': True, 'ImplementsSpatialFilter': True, 'ImplementsStandardFilter': True, 'ImplementsTemporalFilter': False, 'ImplementsVersionNav': False}¶
Metadata of filtering capabilities
- wfs_service_constraints = {'ImplementsBasicWFS': True, 'ImplementsFeatureVersioning': False, 'ImplementsInheritance': False, 'ImplementsLockingWFS': False, 'ImplementsRemoteResolve': False, 'ImplementsResultPaging': True, 'ImplementsSpatialJoins': False, 'ImplementsStandardJoins': False, 'ImplementsTemporalJoins': False, 'ImplementsTransactionalWFS': False, 'KVPEncoding': True, 'ManageStoredQueries': False, 'PagingIsTransactionSafe': False, 'SOAPEncoding': False, 'XMLEncoding': True}¶
Metadata of the capabilities: