gws.gis.cache.store

Filesystem tile store, MapProxy ‘mp’ directory layout.

Source code: gws.gis.cache.store

Module Contents

class gws.gis.cache.store.Object(base_dir: str, max_age: int, extension: str)

Bases: gws.TileStore

Filesystem tile store.

baseDir

Base directory of the store.

extension
maxAge

Max. age of stored tiles in seconds.

drop()

Remove the whole store.

drop_level(z: int)

Remove all tiles of a level.

Parameters:

z – Zoom level.

drop_range(mtr: gws.MapTileRange)

Remove the tiles of a range.

Parameters:

mtr – Tile range.

has(mt: gws.MapTile) → bool

Check if a tile is stored.

Parameters:

mt – Tile.

Returns:

True if the tile is stored and younger than maxAge.

path(mt: gws.MapTile) → str

Return the file path of a tile.

Parameters:

mt – Tile.

Returns:

The file path, whether the tile exists or not.

read(mt: gws.MapTile) → bytes | None

Read a stored tile.

Parameters:

mt – Tile.

Returns:

The tile content, or None if the tile is missing, stale or unreadable.

stats() → gws.TileStoreStats

Compute statistics for the whole store.

Returns:

Number and size of stored tiles. The tile range is not set.

stats_for_level(z: int) → gws.TileStoreStats

Compute statistics for a level.

Parameters:

z – Zoom level.

Returns:

Number, size and bounding tile range of the stored tiles of the level.

write(mt: gws.MapTile, blob: bytes)

Store a tile.

Parameters:
  • mt – Tile.

  • blob – Encoded tile content.