fetch_layers#

KeypressCallbacks.fetch_layers(layers=None, verbose=True, key='x')#

Fetch (and cache) layers of a map.

This is particularly useful if you want to use sliders or buttons to quickly switch between the layers (e.g. once the backgrounds are cached, switching layers will be fast).

Note: After zooming or re-sizing the map, the cache is cleared and you need to call this function again!

Note

Callbacks are layer-sensitive, so you most probably want to attach this callback to the “all”-layer so that it can be triggered independent of the active layer. (e.g. m.all.cb.keypress.attach.fetch_layer()

Parameters:
  • layers (list or None, optional) – A list of layer-names that should be fetched. If None, all layers (except the “all” layer) are fetched. The default is None.

  • verbose (bool) – Indicator if status-messages should be printed or not. The default is True.

  • 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”.