Layers

open external class Layers(baseLayers: Control.LayersObject = definedExternally, overlays: Control.LayersObject = definedExternally, options: Layers.LayersOptions = definedExternally) : Control<Layers.LayersOptions>

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

Base layers will be switched with radio buttons, while overlays will be switched with checkboxes.

Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.

Constructors

Link copied to clipboard
constructor(baseLayers: Control.LayersObject = definedExternally, overlays: Control.LayersObject = definedExternally, options: Layers.LayersOptions = definedExternally)

Types

Link copied to clipboard

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

Properties

Link copied to clipboard
open val onAdd: (map: LeafletMap) -> <Error class: unknown class>?

Should return the container DOM element for the control and add listeners on relevant map events. Called on addTo

Link copied to clipboard
open val onRemove: (map: LeafletMap) -> Unit?

Optional method. Should contain all clean up code that removes the listeners previously added in onAdd. Called on remove.

Functions

Link copied to clipboard
open fun addBaseLayer(layer: Layer<*>, name: String): Layers

Adds a base layer (radio button entry) with the given name to the control.

Link copied to clipboard
open fun addOverlay(layer: Layer<*>, name: String): Layers

Adds an overlay (checkbox entry) with the given name to the control.

Link copied to clipboard

Adds the control to the given map.

Link copied to clipboard
open fun collapse(): Layers

Collapse the control container if expanded.

Link copied to clipboard
open fun expand(): Layers

Expand the control container if collapsed.

Link copied to clipboard
open fun getContainer(): <Error class: unknown class>?

Returns the HTMLElement that contains the control.

Link copied to clipboard

Returns the position of the control.

Link copied to clipboard

Removes the control from the map it is currently active on.

Link copied to clipboard
open fun removeLayer(layer: Layer<*>): Layers

Remove the given layer from the control.

Link copied to clipboard

Sets the position of the control.