gws.plugin.tile_layer.provider

XYZ tile service provider.

Source code: gws.plugin.tile_layer.provider

Module Contents

class gws.plugin.tile_layer.provider.Config(*args, **kwargs)

Bases: gws.Config

XYZ tile service.

grid: gws.lib.grid.Config | None

Tile grid of the source. (changed in 8.5)

maxLevel: int = 19

Finest zoom level the source provides. (added in 8.5)

maxRequests: int = 0

Max. concurrent requests to this source.

url: gws.Url

REST URL with placeholders {x}, {y} and {z}.

class gws.plugin.tile_layer.provider.Object

Bases: gws.Node

XYZ tile service.

grid: gws.MapGrid

Tile grid of the source, web mercator by default.

maxLevel: int

Finest zoom level the source provides.

maxRequests: int

Max. concurrent requests to the source (not used).

url: gws.Url

Tile URL with the placeholders {x}, {y} and {z}.

cache_hash()

Compute a hash of the provider settings.

Returns:

Hash string, built from the URL and the grid.

configure()

Configuration hook.

Called when the node is initialized. Raising an exception here aborts the creation of the node.

get_tile(x: int, y: int, z: int) → bytes

Fetch a tile from the source.

Parameters:
  • x – Tile column.

  • y – Tile row, counted from the top.

  • z – Zoom level.

Returns:

Image bytes.

Raises:

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