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
Image |
Constructs a new ImageLayer. |
Inherited Properties
metadata | A property for associating custom data with the layer. |
Methods
get |
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: |
get |
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: |
get |
Gets the options of the tile layer. |
get |
Calculates the approximate pixels on the source image that align with the provided positions. |
get |
Calculates the approximate positions that align with the provided pixels from the source image. |
set |
Sets the options of the tile layer. |
Inherited Methods
get |
Gets the id of the layer |
get |
Gets the map that the layer is currently added to, or null. |
on |
Initialization method for the layer which is called when added to the map. |
on |
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
Position[]
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
Position[]
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
- options
- ImageLayerOptions
Inherited Method Details
getId()
getMap()
Gets the map that the layer is currently added to, or null.
function getMap(): Map
Returns
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