Add on_click to Marker objects
See original GitHub issueI tried out the new MarkerCluster capability in 0.5.3, and it works great in my notebook here: https://gist.github.com/anonymous/d414d59e50e57e23436adba70fd48b35 but I’m struggling a bit with the interaction. [BTW, this notebook should run anywhere, as it uses only web services to aquire data]
I was originally plotting markers using geoJSON, and the interaction I’m looking for is to return the name of the marker to python when I click on it. In cell [13], with geoJSON, I use feature_layer.on_click to specifying printing the name of the marker below the plot. This works great:

I would like to do the same in cell [15], using MarkerCluster, but I cannot figure out how to get the name of the marker back on click:

There is no feature_layer.on_click for MarkerCluster, and I guess that make sense since I really just need interaction with the individual Marker objects, right?
But the Marker objects don’t seem to have on_click either. Would it be on_trait_change?
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (13 by maintainers)

Top Related StackOverflow Question
I just tried it on the binder (last version of ipyleaflet) and
on_moveseems to work. Do you mind giving me an example so that I can replicate your issue? EDIT: That’s what I tried:Maybe you should extend the official page documentation, by mentioning there also, that the on_click method exists.