LayersOptions

The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the detailed example).

See: https://github.com/Leaflet/Leaflet/blob/v1.7.1/src/control/Control.Layers.js

See also

Properties

Link copied to clipboard
abstract var autoZIndex: Boolean?

If true, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.

Link copied to clipboard
abstract var collapsed: Boolean?

If true, the control will be collapsed into an icon and expanded on mouse hover or touch.

Link copied to clipboard
abstract var hideSingleBase: Boolean?

If true, the base layers in the control will be hidden when there is only one.

Link copied to clipboard
abstract var position: PositionsUnion

The position of the control (one of the map corners).

Link copied to clipboard
abstract var sortFunction: (layerA: Layer<*>, layerB: Layer<*>, nameA: String, nameB: String) -> Number?

A compare function that will be used for sorting the layers, when sortLayers is true.

Link copied to clipboard
abstract var sortLayers: Boolean?

Whether to sort the layers. When false, layers will keep the order in which they were added to the control.