OpenLayers.Tile.Image

Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers.  Create a new image tile with the OpenLayers.Tile.Image constructor.

Inherits from

Summary
OpenLayers.Tile.ImageInstances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers.
Properties
url{String} The URL of the image being requested.
maxGetUrlLength{Number} If set, requests that would result in GET urls with more characters than the number provided will be made using form-encoded HTTP POST.
crossOriginKeywordThe value of the crossorigin keyword to use when loading images.
Constructor
OpenLayers.Tile.ImageConstructor for a new OpenLayers.Tile.Image instance.
Functions
destroynullify references to prevent circular references and memory leaks
getCanvasContextReturns a canvas context associated with the tile image (with the image drawn on it).

Properties

url

{String} The URL of the image being requested.  No default.  Filled in by layer.getURL() function.  May be modified by loadstart listeners.

maxGetUrlLength

{Number} If set, requests that would result in GET urls with more characters than the number provided will be made using form-encoded HTTP POST.  It is good practice to avoid urls that are longer than 2048 characters.

Caution

Older versions of Gecko based browsers (e.g.  Firefox < 3.5) and most Opera versions do not fully support this option.  On all browsers, transition effects are not supported if POST requests are used.

crossOriginKeyword

The value of the crossorigin keyword to use when loading images.  This is only relevant when using getCanvasContext for tiles from remote origins and should be set to either ‘anonymous’ or ‘use-credentials’ for servers that send Access-Control-Allow-Origin headers with their tiles.

Constructor

OpenLayers.Tile.Image

Constructor for a new OpenLayers.Tile.Image instance.

Parameters

layer{OpenLayers.Layer} layer that the tile will go in.
position{OpenLayers.Pixel}
bounds{OpenLayers.Bounds}
url{String} Deprecated.  Remove me in 3.0.
size{OpenLayers.Size}
options{Object}

Functions

destroy

destroy: function()

nullify references to prevent circular references and memory leaks

getCanvasContext

getCanvasContext: function()

Returns a canvas context associated with the tile image (with the image drawn on it).  Returns undefined if the browser does not support canvas, if the tile has no image or if it’s currently loading.

The function returns a canvas context instance but the underlying canvas is still available in the ‘canvas’ property:

var context = tile.getCanvasContext();
if (context) {
    var data = context.canvas.toDataURL('image/jpeg');
}

Returns

{Boolean}

Constructor for a new OpenLayers.Tile.Image instance.
destroy: function()
nullify references to prevent circular references and memory leaks
getCanvasContext: function()
Returns a canvas context associated with the tile image (with the image drawn on it).
This class represents a screen coordinate, in x and y coordinates
Instances of this class represent bounding boxes.
Contains convenience functions for string manipulation.
Instances of this class represent a width/height pair
Close