gws.gis.mpx

MapProxy integration module for GWS.

This module provides functions to interact with MapProxy services for WMS and WMTS requests.

Source code: gws.gis.mpx

Submodules

Package Contents

exception gws.gis.mpx.ServiceException

Bases: Exception

Exception raised when a MapProxy service request fails.

gws.gis.mpx.wms_request(layer_uid: str, bounds: gws.Bounds, width: int, height: int, forward: Dict[str, Any] | None = None) bytes | None

Make a WMS GetMap request to MapProxy.

Parameters:
  • layer_uid – The layer identifier.

  • bounds – The bounding box for the map.

  • width – The width of the requested image in pixels.

  • height – The height of the requested image in pixels.

  • forward – Additional parameters to forward to the WMS request.

Returns:

The image content as bytes if successful, None if the request fails.

gws.gis.mpx.wmts_request(source_uid: str, x: int, y: int, z: int, tile_matrix: str, tile_size: int) bytes | None

Make a WMTS GetTile request to MapProxy.

Parameters:
  • source_uid – The source layer identifier.

  • x – The tile column.

  • y – The tile row.

  • z – The zoom level.

  • tile_matrix – The tile matrix set identifier.

  • tile_size – The size of the tile in pixels.

Returns:

The tile image content as bytes if successful, None if the request fails.