foliplus.LayerControl#
- class foliplus.LayerControl(*, position: Literal['topleft', 'topright', 'bottomleft', 'bottomright'] = 'topleft', locale: str | LocaleConfig | None = None)[source]#
Bases:
BaseControlDrag-and-drop layer ordering with geometry icons, color picker, and panes.
đ Geometry-type icons for quick layer identification.
đ Drag-and-drop reordering, synced to Leaflet render order.
â Multi-select checkboxes with z-index stacking.
đ¨ Color picker to replace base maps with a solid background color.
đ Collapsible panel consistent with other foliplus controls.
Parameters#
- positionstr, default âtopleftâ
One of
"topleft","topright","bottomleft","bottomright".- localestr or LocaleConfig, optional
Language code (
"en","zh") or aLocaleConfiginstance. Defaults to auto-detection, falling back to English.
Notes#
Layer identification relies on
map._layersand thewindowglobal variable at runtime. The initial layer list is collected during rendering by traversing the parent mapâs children.Examples#
>>> import folium >>> from foliplus import LayerControl >>> m = folium.Map() >>> LayerControl().add_to(m)
- __init__(*, position: Literal['topleft', 'topright', 'bottomleft', 'bottomright'] = 'topleft', locale: str | LocaleConfig | None = None)[source]#
Methods
__init__(*[, position, locale])add_child(child[, name, index])Add a child.
add_children(child[, name, index])Add a child.
add_css_link(name, url)Add or update css resource link.
add_js_link(name, url)Add or update JS resource link.
add_to(parent[, name, index])Add element to a parent.
get_bounds()Computes the bounds of the object and all it's children in the form [[lat_min, lon_min], [lat_max, lon_max]].
get_name()Returns a string representation of the object.
get_root()Returns the root of the elements tree.
render(**kwargs)Collect layers from the parent map before rendering.
save(outfile[, close_file])Saves an Element into a file.
to_dict([depth, ordered])Returns a dict representation of the object.
to_json([depth])Returns a JSON representation of the object.
Attributes
default_cssdefault_js