keplergl / kepler.gl

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
http://kepler.gl
MIT License
10.36k stars 1.74k forks source link

[Feature request, Jupyter Widget] Add event callbacks from Kepler widget back to Jupyter #904

Open nlyubchich opened 4 years ago

nlyubchich commented 4 years ago

Is your feature request related to a problem? Please describe. I'm investigating approaches to prototype maps with Kepler.gl with Jupyter Notebook. It's possible to pass data and config from Jupyter to Kepler widget, yet there's no possible way to interact backwards, from Kepler widget to Jupyter.

Is it actually a good idea to extend Kepler widget with any kind of callbacks (e.g. pass onMapClick event with coordinates to Jupyter in order to do some calculation on Jupyter side)?

Describe the solution you'd like Add callbacks for Kepler events in a way as standard Button does the callbacks

Describe alternatives you've considered It's possible to build a dedicated app on top of Kepler, but not sure if would be as fast as Jupyter to research any ideas based on map. It's also possible to use just Leaflet plugin, yet it's required to implement own layers and filters on top of it.

heshan0131 commented 4 years ago

@nlyubchich Can you define 1 or 2 callbacks that would be useful? So we can start to investigate the possibility of it. The jupyter widget architecture actually allows 2-way data binding. kepler.gl widget state is saved in jupyter session. We just need to know what to expose to the python interface

nlyubchich commented 4 years ago

@heshan0131 Thanks for the answer!

The most necessary one is only MAP_CLICK event with coordinates in order to request new data for Kepler on-demand.

We may also consider new onConfigChange event, yet this one can be easily workarounded with checking kepler_map.config on repeatable basis (e.g. check config object every 30s).

dwilson1988 commented 3 years ago

@heshan0131, I'm guessing based on activity this hasn't been a highly requested feature, but I'd like to +1 this. There are plenty of events it would be great to register callbacks for. Particularly of interest for what we're trying to do would be related to drawing features on a map or selecting a feature.

We're building some stuff on ipyleaflet and also looking at leafmap, but it would be great to be able to do similar things with kepler as it's got some great features and is much more visually appealing.

Happy to take a crack at an example if you could point me in roughly the right direction - I haven't dug into kepler yet.

ibgreen commented 3 years ago

AFAIK, there is no activity on adding such callbacks to kepler.gl, though PRs are always welcome.

For reference (may not be a solution for if you require everything to be open source), there is a rich Python SDK (built on kepler.gl open core), which does support event handling including e.g. cross filtering between maps and Python charting libraries.

cross-filtering mov

See e.g: