Coverage for gws-app/gws/plugin/ows_client/wmts/__init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""WMTS client. 

2 

3Uses a layer of a remote WMTS service (version 1.0.0) as a tile layer. 

4 

5Submodules: 

6 

7- ``provider``: the WMTS service provider. Reads the capabilities, builds 

8 tile URL templates and fetches tiles. 

9- ``caps``: parser for the WMTS capabilities document. Reads the layers with 

10 their styles, formats and resource URLs, and the tile matrix sets. 

11- ``layer``: the ``wmts`` image layer that shows the tiles of one source layer. 

12- ``grabber``: the tile grabber used by the layer to fetch source tiles. 

13 

14The layer uses a single source layer (the first selected one), a tile matrix 

15set and a style. The tile matrix set is the one in the forced CRS of the 

16provider or, by default, in the CRS that best matches the map CRS. Tile URLs 

17are taken from the ``ResourceURL`` template of the layer if the service 

18provides one, otherwise a KVP GetTile URL is built. Unless configured 

19otherwise, the layer extent is the extent of the first matrix, clipped to the 

20extent of the source layer, the resolutions are derived from the scales of the 

21matrices, the legend is the legend URL of the style and the metadata is the 

22service metadata. 

23 

24The layer supports two display modes. In the default ``tile`` mode, tiles are 

25fetched by the server through the grabber, cached and served on the map grid, 

26reprojected if needed. In the ``client`` mode, the layer props include the tile 

27URL template and the tile matrix set, and the client loads the tiles directly 

28from the service; this requires a tile matrix set in the map CRS. 

29 

30Reference: OGC 07-057r7, http://portal.opengeospatial.org/files/?artifact_id=35326 

31 

32Example:: 

33 

34 map.layers+ { 

35 title "Base map" 

36 type "wmts" 

37 provider.url "https://example.com/wmts/1.0.0/WMTSCapabilities.xml" 

38 sourceLayers.names ["base_map"] 

39 } 

40 

41 map.layers+ { 

42 title "Base map, loaded by the client" 

43 type "wmts" 

44 display "client" 

45 provider.url "https://example.com/wmts/1.0.0/WMTSCapabilities.xml" 

46 sourceLayers.names ["base_map"] 

47 withCache false 

48 } 

49"""