Coverage for gws-app/gws/base/ows/server/core.py: 100%
38 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
1"""Base data structures for OWS services."""
3from typing import Optional
5import gws
8class Error(gws.Error):
9 """OWS server error."""
11 pass
14class LayerCaps(gws.Data):
15 """Layer wrapper object.
17 A ``LayerCaps`` object wraps a ``Layer`` object and provides
18 additional data needed to represent a layer in an OWS service.
19 """
21 layer: gws.Layer
22 """Wrapped layer."""
23 title: str
24 """Layer title."""
26 isGroup: bool
27 """The layer is a group."""
28 hasLegend: bool
29 """The layer has a legend."""
30 isSearchable: bool
31 """The layer can be searched."""
33 layerName: str
34 """Layer name in the service."""
35 featureName: str
36 """Feature type name in the service, without a namespace prefix."""
37 geometryName: str
38 """Name of the geometry attribute."""
40 maxScale: int
41 """Max. scale denominator of the layer."""
42 minScale: int
43 """Min. scale denominator of the layer."""
44 bounds: list[gws.Bounds]
45 """Layer extent in each CRS supported by the service."""
47 children: list['LayerCaps']
48 """Direct children of a group."""
49 leaves: list['LayerCaps']
50 """All non-group descendants of a group."""
52 model: Optional[gws.Model]
53 """Model to read the layer features, if any."""
54 xmlNamespace: Optional[gws.XmlNamespace]
55 """XML namespace of the feature type, if any."""
58class FeatureCollectionMember(gws.Data):
59 """A member of a feature collection."""
61 feature: gws.Feature
62 """Feature."""
63 layer: Optional[gws.Layer]
64 """Layer the feature was found in."""
65 layerCaps: Optional[LayerCaps]
66 """Caps of that layer, if it is part of the request."""
69class FeatureCollection(gws.Data):
70 """Feature collection, the result of a search request."""
72 members: list[FeatureCollectionMember]
73 """Collection members."""
74 values: list
75 """Property values, for value requests like ``GetPropertyValue``."""
76 timestamp: str
77 """Time of the response, as an ISO string."""
78 numMatched: int
79 """Total number of matching features."""
80 numReturned: int
81 """Number of returned features."""
84class MetadataCollection(gws.Data):
85 """Metadata collection, the result of a catalog request."""
87 members: list[gws.Metadata]
88 """Metadata records."""
89 timestamp: str
90 """Time of the response, as an ISO string."""
91 numMatched: int
92 """Total number of matching records."""
93 numReturned: int
94 """Number of returned records."""
95 nextRecord: int
96 """Position of the next record, for paging."""
99IMAGE_VERBS = {
100 gws.OwsVerb.GetMap,
101 gws.OwsVerb.GetTile,
102 gws.OwsVerb.GetLegendGraphic,
103}
104"""OWS verbs which are supposed to return images."""