Coverage for gws-app/gws/base/map/__init__.py: 100%
1 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
1"""Maps and the map action.
3A map holds the root of a layer tree together with the CRS, extent, center and
4the resolutions (zoom levels) shared by its layers. Each project has a map.
5The map's layers are created as children of an implicit ``group`` root layer,
6which passes the map extent, resolutions and CRS down the tree (see
7``gws.base.layer``).
9Submodules:
11- ``core``: the ``default`` map object with its ``Config`` and ``Props``.
12 The CRS defaults to Web Mercator. Without an ``extent`` the map covers the
13 maximum extent of its CRS; the center defaults to the center of the extent.
14 The title defaults to the title of the project.
15- ``action``: the ``map`` action. Its commands serve layer images as boxes
16 (``mapGetBox``) and tiles (``mapGetTile``), legends (``mapGetLegend``),
17 layer descriptions (``mapDescribeLayer``) and features (``mapGetFeatures``)
18 to the client. Layers build the URLs for these commands with
19 ``Layer.url_path_for``. Image commands answer with a transparent pixel
20 when the layer renders nothing or rendering fails; the failure is logged.
22Example::
24 actions+ { type "map" }
26 projects+ {
27 title "City map"
28 map {
29 crs 25832
30 extent [ 280000 5640000 300000 5660000 ]
31 zoom.scales [ 100000 50000 25000 10000 5000 ]
32 zoom.initScale 25000
33 layers+ { type "qgis" provider.path "/data/city.qgs" }
34 }
35 }
36"""
38from .core import Config, Object, Props