gws.plugin.ows_client.wmts.provider

WMTS service provider.

Source code: gws.plugin.ows_client.wmts.provider

Module Contents

class gws.plugin.ows_client.wmts.provider.Config

Bases: gws.base.ows.client.provider.Config

Connection to a WMTS service.

class gws.plugin.ows_client.wmts.provider.Object

Bases: gws.base.ows.client.provider.Object

WMTS service provider.

Reads the capabilities of a WMTS service, builds tile URL templates and fetches tiles for the layers that use the service.

protocol
tileMatrixSets: list[gws.TileMatrixSet]

Tile matrix sets offered by the service.

configure()
get_tile(url_template: str, matrix_uid: str, col: int, row: int) → bytes

Fetch a tile.

Parameters:
  • url_template – URL template from tile_url_template.

  • matrix_uid – Tile matrix identifier.

  • col – Tile column.

  • row – Tile row.

Returns:

The tile image content.

Raises:

gws.ExternalServiceError – If the request fails or the response is not an image.

tile_url_template(sl: gws.SourceLayer, tms: gws.TileMatrixSet, style: gws.SourceStyle) → str

Create a tile URL template for a source layer.

If the layer has a ResourceURL of type tile, its template is used, with {TileMatrixSet} and {Style} filled in. Otherwise, a KVP GetTile URL is built, with the layer format or image/jpeg. In both cases the result contains the {TileMatrix}, {TileCol} and {TileRow} placeholders.

Parameters:
  • sl – Source layer.

  • tms – Tile matrix set.

  • style – Source style.

Returns:

The URL template.