-
Notifications
You must be signed in to change notification settings - Fork 958
Open
Milestone
Description
Hello,
I created a leaflet map on my jupyterlab notebook with WidgetsControl.
I added a widgets.dropdown that allows me to change the layer using a widgets.link that works.
Now, I want to put my map in an HTML page by changing the widgets.link by a widgets.jslink but an error occurs.
TypeError: Dropdown.value can not be synced
import ipywidgets as wid
import ipyleaflet as lf
from ipywidgets.embed import embed_minimal_html
nasa_layer_1 = lf.basemap_to_tiles(lf.basemaps.NASAGIBS.ModisTerraTrueColorCR, "2019-04-15")
nasa_layer_2 = lf.basemap_to_tiles(lf.basemaps.NASAGIBS.ModisTerraTrueColorCR, "2018-04-13")
layers = {}
layers['nasa1'] = (nasa_layer_1,)
layers['nasa2'] = (nasa_layer_2,)
m = lf.Map(
center=(50.6330372,3.0178653),
scroll_wheel_zoom = True,
zoom=2)
''''
Dropdown to select the layer. The layers have to be in the dictionary 'layers'.
'''
layer_selector = wid.Dropdown(
options=layers,
description='Layer :',
)
wid.link((layer_selector,'value'),(m,'layers'))
#Control display on the map
layer_selector_control = lf.WidgetControl(widget=layer_selector, position='bottomright')
m.add_control(layer_selector_control)
embed_minimal_html('export.html', views=[m], title='Widgets export')
m
I would like to know if it's possible or not to do this.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels