Class: LayerSwitcher

cercaliagl.control/LayerSwitcher


Javascript ES5

const control = new cercaliagl.control.LayerSwitcher();

This is a layer switcher control. Base layer can be changed via this control. It is possible to add custom layers. You can see some examples in `Examples` page.

new LayerSwitcher(options)

Name Type Description
options

Options

Name Type Description
mapLayers Array.<string> | undefined

Maps array to be painted. Admitted values:
cercaliagl.MapTypes.CERCALIA
cercaliagl.MapTypes.OSM
cercaliagl.MapTypes.SATELLITE
cercaliagl.MapTypes.DARK
cercaliagl.MapTypes.SYLVER
cercaliagl.MapTypes.EMPTY

active string

Active base layer id

Extends

Methods

changeBaseLayer(baselayerId)

Change base layer with a given base layer id.

Name Type Description
baselayerId string

Base layer id.

Close dropdown user interface component

Returns cercalia Map object

Returns:
Cercalia map.

getClass(){string} inherited

Get class name.

Returns:
Class name.

getElement(){Element} inherited

Get control HTML Element

Returns:
HTML Element

Get control id.

Returns:
Id.

getMap(){module:maplibre-gl~Map} inherited

Returns mapboxgl Map object

getName(){string|null} inherited

Get control name. Null if control has not defined name.

Returns:
Class name.

Hide control.

Open dropdown user interface component

Show control.