gws.plugin.ows_server.wmts¶
WMTS service.
Implements WMTS 1.0.0 with the operations GetCapabilities, GetTile and
GetLegendGraphic. Only GET requests with KVP encoding are supported.
The service publishes the project layers that are not groups and can render
a box. For each supported CRS of the service, it offers one tile matrix set
named TMS_<srid>, with levels 0 to MAX_LEVEL; the matrix identifiers
are the zero-padded level numbers (00, 01, …). The tile matrix sets
are based on map grids: the grid configured in grids for the CRS, or the
default grid for the CRS. All layers share the same tile matrix sets.
GetTile renders the requested layer into a tile of the grid size. With the
developer option ows.annotate_wmts, the tile is annotated with its
matrix, row, column and extent.
Templates:
templates/getCapabilities.cx.py:ows.GetCapabilities.
References:
OGC 07-057r7 (https://portal.ogc.org/files/?artifact_id=35326)
Example:
projects+ {
owsServices+ {
type "wmts"
uid "my_wmts"
supportedCrs [3857 25832]
grids+ {
crs 25832
extent [280000 5200000 920000 6100000]
}
}
}
Source code: gws.plugin.ows_server.wmts
Subpackages¶
Package Contents¶
- class gws.plugin.ows_server.wmts.Config¶
Bases:
gws.base.ows.server.service.ConfigWMTS service that serves the project layers as tiles.
- grids: list[gws.lib.grid.Config] | None¶
Tile matrix grids, one per CRS. (added in 8.5)
- gws.plugin.ows_server.wmts.MAX_LEVEL = 20¶
Finest advertised tile matrix level.
- class gws.plugin.ows_server.wmts.Object¶
Bases:
gws.base.ows.server.service.ObjectWMTS service that renders the project layers as tiles.
- grids: dict[str, gws.MapGrid]¶
Grids by tile matrix set identifier.
- isOwsCommon = True¶
- isRasterService = True¶
- protocol¶
- supportedVersions = ['1.0.0']¶
- tileMatrixSets: list[gws.TileMatrixSet]¶
Tile matrix sets, one for each supported CRS.
- bounds_for_tile(tms_uid, tm_uid, row, col)¶
Compute the bounds of a tile.
- Parameters:
tms_uid – Tile matrix set identifier.
tm_uid – Tile matrix identifier.
row – Tile row.
col – Tile column.
- Returns:
The tile bounds, or
Noneif the tile matrix set or the tile matrix is unknown.
- configure()¶
- configure_operations()¶
- configure_templates()¶
- get_matrix(tms: gws.TileMatrixSet, tm_uid)¶
Find a tile matrix in a tile matrix set by its identifier.
- Parameters:
tms – Tile matrix set.
tm_uid – Tile matrix identifier.
- Returns:
The tile matrix, or
Noneif not found.
- get_matrix_set(tms_uid)¶
Find a tile matrix set by its identifier.
- Parameters:
tms_uid – Tile matrix set identifier.
- Returns:
The tile matrix set, or
Noneif not found.
- handle_get_capabilities(sr: gws.base.ows.server.request.Object)¶
Handle the GetCapabilities operation.
- Parameters:
sr – Service request.
- Returns:
The capabilities document.
- 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_tile(sr: gws.base.ows.server.request.Object)¶
Handle the GetTile operation.
- Parameters:
sr – Service request.
- Returns:
The tile image.
- Raises:
server.error.InvalidParameterValue – If not exactly one layer is requested.
server.error.TileOutOfRange – If the tile matrix set or the tile matrix is unknown.
- init_request(req)¶
- make_tile_matrices(mg: gws.MapGrid, min_zoom, max_zoom)¶
Create the tile matrices for a range of grid levels.
- Parameters:
mg – Map grid.
min_zoom – First level.
max_zoom – Last level, inclusive.
- Returns:
A list of tile matrices, one for each level.
- requested_layer_caps(sr: gws.base.ows.server.request.Object)¶
Find the layer caps for the layer names in the
LAYERparameter.- Parameters:
sr – Service request.
- Returns:
The matching layer caps without duplicates.
- Raises:
server.error.LayerNotDefined – If no layer is found.