From this GH issue, it seems like it should. But I know, there doesn’t seem to be any official leafmap examples at panel’s documentation. I am running local JupyterLab server, installled with just pip, not conda. But I can’t seem to get my example to work even after pip install ipywidgets_bokeh. I would execute the code cell, but nothing gets rendered below it. An output cell is created, but it is blank. No errors are showing up in the console that I launched jupyter lab from. Not sure how to look for relevant javascript errors using browser console.
My example is pretty similar to the one in the GH issue, but even simpler:
import leafmap.foliumap as leafmap
import panel as pn
pn.extension(sizing_mode="stretch_width")
def get_map():
return leafmap.Map(center=[40, -83], zoom=5)
my_map = get_map()
pn.panel(my_map, height=400) or pn.Column(my_map)
If I have a code cell that just executes my_map, it renders the leafmap fine. So I know my leafmap works fine or is setup properly.
Leafmap developer here. This issue is interesting. Usually the ipyleaflet plotting backend is a bit more tricky to use than folium mostly due to the complication caused by the package installation. In your case, it is the opposite, ipyleaflet work while folium doesn’t. Thanks Marc for providing the workaround. It would be great to have support for bidirecitonal communication for folium.