Maps.cb.click.attach

class eomaps.eomaps.Maps.cb.click.attach(parent)

Attach custom or pre-defined callbacks to the map.

Callback-functions accept the following additional keyword-arguments:

double_clickbool

Indicator if the callback should be executed on double-click (True) or on single-click events (False). The default is False

buttonint

The mouse-button to use for executing the callback:

  • LEFT = 1

  • MIDDLE = 2

  • RIGHT = 3

  • BACK = 8

  • FORWARD = 9

The default is None in which case 1 (e.g. LEFT is used)

modifierstr or None

Define a keypress-modifier to execute the callback only if the corresponding key is pressed on the keyboard.

  • If None, the callback is executed if no modifier is activated.

The default is None.

on_motionbool

!! Only relevant for β€œclick” callbacks !!

  • True: Continuously execute the callback if the mouse is moved while the assigned button is pressed.

  • False: Only execute the callback on clicks.

The default is True.

For additional keyword-arguments check the doc of the callback-functions!

Examples

Get a (temporary) annotation on a LEFT-double-click:

>>> m.cb.click.attach.annotate(double_click=True, button=1, permanent=False)

Permanently color LEFT-clicked pixels red with a black border:

>>> m.cb.pick.attach.mark(facecolor="r", edgecolor="k", permanent=True)

Attach a customly defined callback

>>> def some_callback(self, asdf, **kwargs):
>>>     print("hello world")
>>>     print("the position of the clicked pixel", kwargs["pos"])
>>>     print("the data-index of the clicked pixel", kwargs["ID"])
>>>     print("data-value of the clicked pixel", kwargs["val"])
>>>     print("the plot-crs is:", self.crs_plot)
>>> m.cb.pick.attach(some_callback, double_click=False, button=1, asdf=1)

Members

annotate

Add a text-annotation to the plot at the position where the map was clicked.

clear_annotations

Remove all temporary and permanent annotations from the plot.

clear_markers

Remove all temporary and permanent annotations from the plot.

get_values

Successively collect return-values in a dict.

mark

Draw markers at the location where the map was clicked.

peek_layer

Overlay a part of the map with a different layer if you click on the map.

plot

Generate a dynamically updated plot showing the values of the picked pixels.

print_to_console

Print details on the clicked pixel to the console.