Layer class

Abstract class for other layer classes to extend.

Extends

Constructors

Layer(string)

Properties

metadata

A property for associating custom data with the layer.

Methods

getId()

Gets the id of the layer

getMap()

Gets the map that the layer is currently added to, or null.

getOptions()

Gets the options of the layer.

onAdd(Map)

Initialization method for the layer which is called when added to the map.

onRemove()

Method that is called when the layer is removed from the map. Should perform any necessary cleanup for the layer.

setOptions(LayerOptions)

Sets the options of the layer.

Constructor Details

Layer(string)

new Layer(id?: string)

Parameters

id

string

Property Details

metadata

A property for associating custom data with the layer.

metadata?: any

Property Value

any

Method Details

getId()

Gets the id of the layer

function getId(): string

Returns

string

getMap()

Gets the map that the layer is currently added to, or null.

function getMap(): Map

Returns

Map

getOptions()

Gets the options of the layer.

function getOptions(): LayerOptions

Returns

onAdd(Map)

Initialization method for the layer which is called when added to the map.

function onAdd(map: Map)

Parameters

map
Map

The map the layer has been added to.

onRemove()

Method that is called when the layer is removed from the map. Should perform any necessary cleanup for the layer.

function onRemove()

setOptions(LayerOptions)

Sets the options of the layer.

function setOptions(options: LayerOptions)

Parameters

options
LayerOptions

The new options of the layer.