split_map versions #680
Replies: 3 comments 5 replies
-
I also wanted to check the reason for disabling dragging in (1) and (2)? could we add an option for this instead? |
Beta Was this translation helpful? Give feedback.
-
These are great improvements. Please feel free to submit a PR. Dragging is temporarily disabled due to the ipylealfet bug jupyter-widgets/ipyleaflet#1115. I don't think it has been fixed. You can give it a try by setting |
Beta Was this translation helpful? Give feedback.
-
#681 Added support for numpy.ndarray and xarray.DataArray in split_map versions (1) and (3) mentioned above. |
Beta Was this translation helpful? Give feedback.
-
There are three versions of
split_map
:(1) as a method of
leafmap.Map
(ipyleaflet.Map)(2) as function
leafmap.split_map
(3) as a method of
leafmap.foliumap.Map
(folium.Map)The notebook
49_split_control.ipynb
shows how to use (3) because ipyleaflet SplitControl does not support streamlit, and it shows how to do a splitmap using:The first two (basemap and COG urls) are easy to use, since you can pretty much just do
m.split_map(left_layer, right_layer)
, while for the third example you need to first setup each layer by callingfolium.WmsTileLayer
. This is because all versions ofsplit_map
first check if they are strings (a basemap, a url, etc) or an ipyleaflet.TileLayer.I am interested in making a
split_map
to compare between two local rasters, but I would like to know if there's room for improvement for streamlining the 3 versions ofsplit_map
and if there is already an effort to do so. I made some modifications to (1) that borrow code fromadd_raster
(a call toarray_to_image
andget_local_tile_layer
), and requires passing some keyword arguments to at leastget_local_tile_layer
, e.g., looks like this:Similarly, I think the
folium.WmsTileLayer
example could be simplified by usingleft_args
andright_args
.However, these changes would have to be repeated for all versions of
split_map
. Should we add these incrementally (e.g. I could make a PR for the changes to (1))?Beta Was this translation helpful? Give feedback.
All reactions