Interactive Geometry Drawing in Lonboard
Is your feature request related to a problem? Please describe.
In some demo notebooks, I want users to be able to draw polygons (e.g., AOIs) interactively. Currently, I use ipyleaflet’s DrawControl, but it requires extra installation steps and breaks the flow when trying to keep dependencies minimal and use Lonboard exclusively.
Describe the solution you'd like
Support basic interactive geometry drawing (starting with polygons) directly within Lonboard maps in notebooks. Ideally, the tool would emit GeoJSON output or support a callback for accessing drawn features.
Describe alternatives you've considered
I’ve used ipyleaflet, which works well but adds unnecessary complexity when Lonboard is already used for visualization. Exporting geometry separately and uploading it to the notebook is also possible, but it breaks the interactivity.
Additional context
Reference: ipyleaflet.GeomanDrawControl shows the kind of lightweight functionality that would be helpful. Even minimal polygon drawing would unlock essential use cases in educational and exploratory workflows.
@zacdezgeo - @vgeorge and I were involved a bit in implementing the BBOX select feature on lonboard, and this feels a bit similar (just a bit more complicated) to that.
I'd be happy to be involved a bit sketching this out if we do want to implement this.
Am a bit on the fence on the utility of this - it seems like it is easy enough to quickly draw a polygon on something like geojson.io and paste in the GeoJSON or, as you mention, use ipyleaflet. It does seem nice to be able to do this directly in lonboard, of course.
If @kylebarron thinks this is a good idea to do and if this needs some help, reach out! cc @vgeorge
I don't think there's an existing stable drawing tool for deck.gl. https://github.com/uber/nebula.gl was the gold standard. It was forked into https://github.com/visgl/deck.gl-community/tree/master/modules/editable-layers but it's really not maintained.
With the refactor in #921, there will be two modes in lonboard: a "deck.gl-driven" mode and a "maplibre-driven" mode. In the latter, we would be able to integrate the existing mapbox-gl-draw pretty easily. Demo here: https://visgl.github.io/react-map-gl/examples/maplibre/draw-polygon
Another option would be to implement a native deck.gl adapter for https://github.com/JamesLMilner/terra-draw