Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

LayerToggle

A switch that shows/hides a lonboard layer by writing its visible trait.

Import

from manywidgets.lonboard import LayerToggle

Example

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

TraitTypeDefaultDescription
layerInstanceThe lonboard layer to show/hide.
valueBoolTrueDesired layer visibility.
labelUnicode'Layer'Label next to the switch.
widget_idUnicode''Stable unique id used for cross-widget linking (auto-assigned).