switch_layer#

KeypressCallbacks.switch_layer(layer, key='x')#

Set the currently visible layer of the map.

Parameters:
  • layer (str or list) –

    The layer-name to use (or a list of layer-names to combine).

    For details on how to specify layer-names, see Maps.show_layer()

  • Parameters (Additional)

  • ---------------------

  • key (str, optional) – The key to use for triggering the callback. Modifiers are indicated with a “+”, e.g. “alt+x”. The default is “x”.

Examples

Show layer A:

>>> m.cb.keypress.attach.overlay_layer(layer="A", key="x")

Show layer B with 50% transparency on top of layer A

>>> m.cb.keypress.attach.overlay_layer(layer="A|B{0.5}", key="x")

Show layer B on top of layer A:

>>> m.cb.keypress.attach.overlay_layer(layer=["A", "B"], key="x")

Show layer B with 50% transparency on top of layer A

>>> m.cb.keypress.attach.overlay_layer(layer=["A", ("B", 0.5)], key="x")