Coverage for gws-app/gws/gis/__init__.py: 100%

0 statements  

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

1"""GIS functionality built on the libraries. 

2 

3This package holds GIS code that is more specific than the general purpose 

4libraries in ``gws.lib`` and is meant to be independent of the configurable 

5objects in ``gws.base``. It sits between ``lib`` and ``base`` in the import 

6hierarchy. 

7 

8Subpackages: 

9 

10- ``cache``: tile cache management: the cache configuration, the filesystem 

11 tile store used by grabbers, and the ``gws cache`` commands to inspect, 

12 seed and drop caches. 

13- ``render``: map rendering for printing, exporting and templates. Renders 

14 input planes (image layers, SVG layers, features, images) into alternating 

15 raster and SVG output planes, and converts the output to HTML. 

16- ``source``: source layers of external services (WMS, WFS, WMTS, QGIS), read 

17 from their capabilities, and the filters that select them. 

18- ``zoom``: zoom levels of maps and layers: resolutions computed from the 

19 ``zoom`` configuration and conversion between scales and resolutions. 

20 

21How they relate: 

22 

23``zoom`` provides the resolutions that maps and layers are configured with. 

24``source`` describes what an external service offers; layers in ``gws.base`` 

25and in plugins pick their source layers from it. ``render`` renders a map 

26view by asking each layer for a box image or SVG elements; image layers 

27produce their images through grabbers, which keep their tiles in the 

28``cache`` stores. 

29 

30Example:: 

31 

32 import gws 

33 import gws.gis.render 

34 import gws.gis.zoom 

35 import gws.lib.crs 

36 

37 scale = gws.gis.zoom.res_to_scale(10, gws.lib.crs.WEBMERCATOR) 

38 

39 view = gws.gis.render.map_view_from_center( 

40 size=(200, 150, gws.Uom.mm), 

41 center=(1000, 2000), 

42 crs=gws.lib.crs.WEBMERCATOR, 

43 dpi=150, 

44 scale=10000, 

45 ) 

46"""