A switch that shows/hides a lonboard layer
by writing its visible trait.
Import¶
from manywidgets.lonboard import LayerToggleExample¶
from lonboard import Map, ScatterplotLayer
from manywidgets.lonboard import LayerToggle
layer = ScatterplotLayer.from_geopandas(gdf)
m = Map(layer, basemap=None)
toggle = LayerToggle(layer, label="Points")
# show the control and the map together (see the Layout widgets)
from manywidgets import Column
Column(toggle, m)API¶
| Trait | Type | Default | Description |
|---|---|---|---|
layer | Instance | — | The lonboard layer to show/hide. |
value | Bool | True | Desired layer visibility. |
label | Unicode | 'Layer' | Label next to the switch. |
widget_id | Unicode | '' | Stable unique id used for cross-widget linking (auto-assigned). |