ImageLayer class

Overlays an image on the map with each corner anchored to a coordinate on the map. Also known as a ground or image overlay.

Extends

Constructors

ImageLayer(ImageLayerOptions, string)

Constructs a new ImageLayer.

Inherited Properties

metadata

A property for associating custom data with the layer.

Methods

getCoordinatesFromEdges(number, number, number, number, number)

Calculates coordinates for a rotated image layer when provided with the bounding box edges and rotation value. Note: If your rotation value is from a KML Ground Overlay it will need to be converted to a clockwise rotation using the following formula: rotation = 360 – KmlRotation

getCoordinatesFromEdges(number, number, number, number, number)

Calculates coordinates for a rotated image layer when provided with the bounding box edges and rotation value. Note: If your rotation value is from a KML Ground Overlay it will need to be converted to a clockwise rotation using the following formula: rotation = 360 – KmlRotation

getOptions()

Gets the options of the tile layer.

getPixels(Position[])

Calculates the approximate pixels on the source image that align with the provided positions.

getPositions(Pixel[])

Calculates the approximate positions that align with the provided pixels from the source image.

setOptions(ImageLayerOptions)

Sets the options of the tile layer.

Inherited Methods

getId()

Gets the id of the layer

getMap()

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

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.

Constructor Details

ImageLayer(ImageLayerOptions, string)

Constructs a new ImageLayer.

new ImageLayer(options: ImageLayerOptions, id?: string)

Parameters

options
ImageLayerOptions

The options for the tile layer.

id

string

The id of the layer. If not specified a random one will be generated.

Inherited Property Details

metadata

A property for associating custom data with the layer.

metadata?: any

Property Value

any

Inherited From Layer.metadata

Method Details

getCoordinatesFromEdges(number, number, number, number, number)

Calculates coordinates for a rotated image layer when provided with the bounding box edges and rotation value. Note: If your rotation value is from a KML Ground Overlay it will need to be converted to a clockwise rotation using the following formula: rotation = 360 – KmlRotation

static function getCoordinatesFromEdges(north: number, south: number, east: number, west: number, rotation?: number): Position[]

Parameters

north

number

The north edge of the bounding box.

south

number

The south edge of the bounding box.

east

number

The east edge of the bounding box.

west

number

The west edge of the bounding box.

rotation

number

Clockwise rotation in degrees

Returns

getCoordinatesFromEdges(number, number, number, number, number)

Calculates coordinates for a rotated image layer when provided with the bounding box edges and rotation value. Note: If your rotation value is from a KML Ground Overlay it will need to be converted to a clockwise rotation using the following formula: rotation = 360 – KmlRotation

static function getCoordinatesFromEdges(north: number, south: number, east: number, west: number, rotation?: number): Position[]

Parameters

north

number

The north edge of the bounding box.

south

number

The south edge of the bounding box.

east

number

The east edge of the bounding box.

west

number

The west edge of the bounding box.

rotation

number

Clockwise rotation in degrees

Returns

getOptions()

Gets the options of the tile layer.

function getOptions(): ImageLayerOptions

Returns

getPixels(Position[])

Calculates the approximate pixels on the source image that align with the provided positions.

function getPixels(positions: Position[]): Promise<Pixel[]>

Parameters

positions

Position[]

the provided positions from the source image used to calculate the pixels

Returns

Promise<Pixel[]>

getPositions(Pixel[])

Calculates the approximate positions that align with the provided pixels from the source image.

function getPositions(pixels: Pixel[]): Promise<Position[]>

Parameters

pixels

Pixel[]

the provided pixels from the source image used to calculate the positions

Returns

Promise<Position[]>

setOptions(ImageLayerOptions)

Sets the options of the tile layer.

function setOptions(options: ImageLayerOptions)

Parameters

Inherited Method Details

getId()

Gets the id of the layer

function getId(): string

Returns

string

Inherited From Layer.getId

getMap()

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

function getMap(): Map

Returns

Map

Inherited From Layer.getMap

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.

Inherited From Layer.onAdd

onRemove()

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

function onRemove()

Inherited From Layer.onRemove