ipyleaflet icon indicating copy to clipboard operation
ipyleaflet copied to clipboard

Add a SelectControl layer for selecting a bounding box

Open deeplook opened this issue 5 years ago • 5 comments

At the moment we have DrawControl to manually specify some polyline/polygon on the map. I have tried to use it for selecting an "area of interest" which would be observable and could be used with a callback to operate on the shown data or add some other mini plot to the map or whatever. But DrawControl is just not usable quick enough for that purpose. And it is kind of "hard" to define a really rectangular area, anyway.

So, having something like a dead-simple SelectControl which can be used quickly by clicking on one point and dragging to the opposite corner of the resulting bounding box would be really useful, and maybe also easy to implement. I guess having only one such area at any time should make it quite simple and avoid the temptation to make it too DrawControl-like (which can create several polylines/polygons, but provides only one handle to the latest one created, anyway).

Maybe there would be a better name, too, like BBoxControl or the like...

deeplook avatar May 14 '20 12:05 deeplook

Indeed. People use the DrawControl for selections, but it was not designed for that. It would be nicer to have something especially for selections. Do you have any thoughts/opinions concerning this @giswqs ?

martinRenou avatar May 14 '20 12:05 martinRenou

I use the DrawControl in geemap to draw shapes and then convert them to Earth Engine geometry, which can then be used as roi to filter other Earth Engine objects. It would be nice to have a SelectControl.

giswqs avatar May 14 '20 12:05 giswqs

From https://ipyleaflet.readthedocs.io/en/latest/api_reference/draw_control.html I see now there is a draw_control.rectangle() and draw_control.circle() method, too, but I don't think this invalidates the arguments above, does it? Especially as the drawn shapes cannot be dragged around.

deeplook avatar May 14 '20 18:05 deeplook

I don't think this invalidates the arguments above

Me neither. The DrawControl can draw shapes, but it's not designed for selections. It would be nice to have a control that is especially designed for that.

martinRenou avatar May 15 '20 06:05 martinRenou

From https://ipyleaflet.readthedocs.io/en/latest/api_reference/draw_control.html I see now there is a draw_control.rectangle() and draw_control.circle() method, too, but I don't think this invalidates the arguments above, does it? Especially as the drawn shapes cannot be dragged around.

Link to DrawControl changed to https://ipyleaflet.readthedocs.io/en/latest/controls/draw_control.html

shinkenuu avatar May 14 '22 15:05 shinkenuu