gws.test.mockmap.services

Mockmap services: protocols, tile addressing, rendering.

Source code: gws.test.mockmap.services

Module Contents

gws.test.mockmap.services.create(cfg: dict, scn: gws.test.mockmap.scene.Scene) → Service
gws.test.mockmap.services.draw_overlay(img: gws.Image, text: str)
gws.test.mockmap.services.draw_probe(img: gws.Image)

Stamp a pixel-aligned checkerboard on a fixed lattice.

The only mark in the image drawn in raster space rather than world space, so it is exactly aligned to the output pixels and carries no antialiasing: at 1:1 it is two colors and nothing else. Any resampling downstream - a scale off the ladder, an unwanted reprojection, a half-pixel shift - softens its edges into intermediate grays. Repeated across the image so it survives cropping into tiles.

Blocks are PROBE_BLOCK pixels, not single pixels. Single pixels sit at the Nyquist frequency and detect the smallest possible resampling, but they also collapse under the 2x device scaling of a HiDPI screen, so the mark cannot be read by eye in a browser. Blocks trade some sensitivity for legibility.

gws.test.mockmap.services.METERS_PER_DEGREE = 111319.4907932736
gws.test.mockmap.services.MIN_RESOLUTION = 1.0
gws.test.mockmap.services.PIXEL_SIZE = 0.00028
gws.test.mockmap.services.PROBE_BLOCK = 4
gws.test.mockmap.services.PROBE_SIZE = 16
gws.test.mockmap.services.PROBE_STEP = 128
class gws.test.mockmap.services.Service(cfg: dict, scn: gws.test.mockmap.scene.Scene)
bbox
cfg
crs
extent
layer
overlay
overlayTile
probe
restful = False
scene
style
tms
tmsOrigin = 'nw'
type = ''
uid
version = ''
wgs
axis_extent(ext)
abstractmethod handle(rest, query, base)
image(extent, size, label='')
tile(z, x, y)
xml(func, base)
class gws.test.mockmap.services.Tile(cfg: dict, scn: gws.test.mockmap.scene.Scene)

Bases: Service

tmsOrigin = 'sw'
type = 'tms'
handle(rest, query, base)
gws.test.mockmap.services.TILE_SIZE = 256
class gws.test.mockmap.services.Tms(crs: gws.Crs, origin: str)

A metric tile grid for a CRS.

The frame is the CRS extent, level 0 is a single tile across its width and levels run down to MIN_RESOLUTION. EPSG:3857 is the exception: XYZ carries no grid metadata, so clients assume the de-facto slippy-map frame, a square. That is a convention, not something derivable from the CRS, whose own extent spans latitude +-85.06 degrees.

bbox
crs
matrices = []
origin
originX = -20037508.342789244
originY = 20037508.342789244
resolutions = []
tileSize = 256
uid
matrix_size(z: int) → tuple[int, int]
span(z: int) → float
tile_extent(z: int, x: int, y: int) → gws.Extent
gws.test.mockmap.services.TYPES
gws.test.mockmap.services.WEBMERCATOR_SQUARE = 20037508.342789244
class gws.test.mockmap.services.Wms(cfg: dict, scn: gws.test.mockmap.scene.Scene)

Bases: Service

tmsOrigin = ''
type = 'wms'
handle(rest, query, base)
class gws.test.mockmap.services.Wmts(cfg: dict, scn: gws.test.mockmap.scene.Scene)

Bases: Service

restful = False
tmsOrigin = 'nw'
type = 'wmts'
handle(rest, query, base)
class gws.test.mockmap.services.WmtsRest(cfg: dict, scn: gws.test.mockmap.scene.Scene)

Bases: Service

restful = True
tmsOrigin = 'nw'
type = 'wmts_rest'
handle(rest, query, base)
class gws.test.mockmap.services.Xyz(cfg: dict, scn: gws.test.mockmap.scene.Scene)

Bases: Service

tmsOrigin = 'nw'
type = 'xyz'
handle(rest, query, base)