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

1"""Base data structures for OWS services.""" 

2 

3from typing import Optional 

4 

5import gws 

6 

7 

8class Error(gws.Error): 

9 """OWS server error.""" 

10 

11 pass 

12 

13 

14class LayerCaps(gws.Data): 

15 """Layer wrapper object. 

16 

17 A ``LayerCaps`` object wraps a ``Layer`` object and provides 

18 additional data needed to represent a layer in an OWS service. 

19 """ 

20 

21 layer: gws.Layer 

22 """Wrapped layer.""" 

23 title: str 

24 """Layer title.""" 

25 

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.""" 

32 

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.""" 

39 

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.""" 

46 

47 children: list['LayerCaps'] 

48 """Direct children of a group.""" 

49 leaves: list['LayerCaps'] 

50 """All non-group descendants of a group.""" 

51 

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.""" 

56 

57 

58class FeatureCollectionMember(gws.Data): 

59 """A member of a feature collection.""" 

60 

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.""" 

67 

68 

69class FeatureCollection(gws.Data): 

70 """Feature collection, the result of a search request.""" 

71 

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.""" 

82 

83 

84class MetadataCollection(gws.Data): 

85 """Metadata collection, the result of a catalog request.""" 

86 

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.""" 

97 

98 

99IMAGE_VERBS = { 

100 gws.OwsVerb.GetMap, 

101 gws.OwsVerb.GetTile, 

102 gws.OwsVerb.GetLegendGraphic, 

103} 

104"""OWS verbs which are supposed to return images."""