Coverage for gws-app/gws/base/ows/server/__init__.py: 0%

3 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-04-17 01:37 +0200

1"""OWS services. 

2 

3Base for ``WMS``, ``WMTS`` and ``WFS`` services. 

4 

5Configuration 

6------------- 

7 

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

9 

10When invoked, the service locates the project (the bound project or ``projectUid`` for global services) 

11and collects all suitable layers from the project. 

12 

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

14 

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

16 

17XML Namespaces 

18-------------- 

19 

20A ``WFS`` service requires each involved layer to have a configured XML namespace (with ``ows.featureName <ns>:name`` or ``ows.xmls <ns>``). 

21Additionally, custom namespaces must be configured globally using ``Application.xml`` config. 

22 

23For some layers, we can autogenerate schemas for custom namespaces on the fly from the layer data. 

24To use an autogenerated schema, the ``schemaLocation`` attribute for a namespace must be ``https://<server>/_/owsXml/namespace/<ns>.xsd`` 

25and the ``ows`` action must be enabled globally. 

26 

27Workflow 

28-------- 

29 

30- the ``ows`` action receives a request and locates the Service object and the corresponding Project 

31- the service initializes the ``Request`` (:obj:`gws.base.ows.server.request.Object`) 

32- a tree of ``LayerCaps`` (:obj:`gws.base.ows.server.core.LayerCaps`) is created (or loaded from the cache) 

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

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

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

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

37 

38 

39Formats 

40------- 

41 

42Standard service templates are python templates which use :func:`gws.lib.xmlx.tag` to generate nested XML responses. 

43 

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

45 

46Users can configure their own templates and image formats. The "supported formats" lists in OWS capabilities documents 

47are created automatically, based on configured templates and image formats. 

48 

49 

50References 

51---------- 

52 

53OGC Standards: 

54 

55- OpenGIS Web Map Service (WMS) Implementation Specification 1.3.0 06-042 

56 https://portal.ogc.org/files/?artifact_id=14416 

57 

58- Web Map Service 1.1.1 01-068r3 

59 https://portal.ogc.org/files/?artifact_id=1081&format=pdf 

60 

61- OpenGIS Web Map Tile Service Implementation Standard 1.0.0 07-057r7 

62 https://portal.ogc.org/files/?artifact_id=35326 

63 

64- OpenGIS Web Feature Service 2.0 Interface Standard (also ISO 19142) 2.0 09-025r1 

65 https://portal.ogc.org/files/?artifact_id=39967 

66 

67- OpenGIS Web Feature Service (WFS) Implementation Specification 1.1.0 04-094 

68 https://portal.ogc.org/files/?artifact_id=8339 

69 

70- OGC® Web Coverage Service (WCS) Interface Standard – Core, version 2.1 17-089r1 

71 https://portal.opengeospatial.org/files/17-089r1 

72 

73- OGC Web Service Common Implementation Specification 2.0.0 06-121r9 

74 https://portal.ogc.org/files/?artifact_id=38867 

75 

76Other implementations: 

77 

78- https://mapserver.org/ogc/wms_server.html 

79- https://docs.geoserver.org/latest/en/user/services/wms/reference.html 

80- https://mapserver.org/ogc/wfs_server.html 

81- https://docs.geoserver.org/latest/en/user/services/wfs/reference.html 

82- https://mapserver.org/ogc/wcs_server.html 

83- https://docs.geoserver.org/latest/en/user/services/wcs/reference.html 

84""" 

85 

86from .core import ( 

87 LayerCaps, 

88 FeatureCollection, 

89 FeatureCollectionMember, 

90) 

91from . import service, layer_caps, request, error 

92from .request import TemplateArgs