gws.plugin.ows_server.wms¶
WMS service.
Implements WMS 1.1.x and 1.3.0 with the operations GetCapabilities, GetMap,
GetFeatureInfo and GetLegendGraphic. SLD extensions are not supported, except
GetLegendGraphic, for which only the LAYER/LAYERS parameter is evaluated.
The service publishes the project layers that are groups or can render a box.
A requested group stands for its leaf layers. GetMap renders the requested
layers that are visible at the requested resolution into one image.
GetFeatureInfo runs a search at the clicked point in the queryable layers and
returns the results in GML 2, using the GetFeature template of the WFS service.
DPI or MAP_RESOLUTION parameters are taken into account when the
request resolution is computed.
Templates:
templates/getCapabilities.cx.py:ows.GetCapabilities.../wfs/templates/getFeature2.cx.py:ows.GetFeatureInfo.
Example:
projects+ {
owsServices+ {
type "wms"
uid "my_wms"
supportedCrs [3857 25832]
layerLimit 20
maxPixelSize 4096
}
}
Source code: gws.plugin.ows_server.wms
Subpackages¶
Package Contents¶
- class gws.plugin.ows_server.wms.Config¶
Bases:
gws.base.ows.server.service.ConfigWMS service that renders the project layers.
- class gws.plugin.ows_server.wms.Object¶
Bases:
gws.base.ows.server.service.ObjectWMS service that renders the project layers as map images and returns feature info and legends.
- isOwsCommon = False¶
- isRasterService = True¶
- protocol¶
- supportedVersions = ['1.3.0', '1.1.1', '1.1.0']¶
- configure()¶
- configure_metadata()¶
- configure_operations()¶
- configure_templates()¶
- get_features(sr: gws.base.ows.server.request.Object, lcs: list[gws.base.ows.server.LayerCaps])¶
Search for features at the point given by the
I/J(orX/Y) parameters.Only layers visible at the requested resolution are searched. The search uses the search tolerance of the service.
- Parameters:
sr – Service request, with bounds and resolution already set.
lcs – Layer caps to search.
- Returns:
The feature collection.
- handle_get_capabilities(sr: gws.base.ows.server.request.Object)¶
Handle the GetCapabilities operation.
- Parameters:
sr – Service request.
- Returns:
The capabilities document.
- handle_get_feature_info(sr: gws.base.ows.server.request.Object)¶
Handle the GetFeatureInfo operation.
- Parameters:
sr – Service request.
- Returns:
The feature collection, rendered in the requested
INFO_FORMAT.- Raises:
server.error.LayerNotQueryable – If none of the requested layers is searchable.
- handle_get_legend_graphic(sr: gws.base.ows.server.request.Object)¶
Handle the GetLegendGraphic operation.
- Parameters:
sr – Service request.
- Returns:
The legend image of the requested layers.
- handle_get_map(sr: gws.base.ows.server.request.Object)¶
Handle the GetMap operation.
Layers that are not visible at the requested resolution are skipped; if none remain, an empty image is returned. The background is transparent unless
TRANSPARENT=falseis requested.- Parameters:
sr – Service request.
- Returns:
The map image.
- Raises:
server.error.LayerNotDefined – If no layers are requested.
- init_request(req)¶
- requested_layer_caps(sr: gws.base.ows.server.request.Object, param_name: str, bottom_first=False) list[gws.base.ows.server.LayerCaps]¶
Find the layer caps for the layer names in a request parameter.
A requested group is replaced by its leaf layers. Duplicates are removed.
- Parameters:
sr – Service request.
param_name – Request parameter with the layer names, e.g.
LAYERS.bottom_first – Return the layers bottom-first, as required for GetMap. Otherwise, the layers are returned top-first.
- Returns:
The layer caps.
- Raises:
server.error.LayerNotDefined – If a layer name is unknown or no layers are requested.
server.error.InvalidParameterValue – If more layers than
layerLimitare requested.
- set_size_and_resolution(sr: gws.base.ows.server.request.Object)¶
Set the bounds, the pixel size and the resolution of the request.
The values are taken from the
BBOX,WIDTHandHEIGHTparameters. IfDPIorMAP_RESOLUTIONis given, the resolution is converted from that DPI.- Parameters:
sr – Service request.
- Raises:
server.error.MissingParameterValue – If
BBOXis missing.server.error.InvalidParameterValue – If the width or height is out of range.