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.
OpenLayers. | Instances 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. |
crossOriginKeyword | The value of the crossorigin keyword to use when loading images. |
Constructor | |
OpenLayers. | Constructor for a new OpenLayers.Tile.Image instance. |
Functions | |
destroy | nullify references to prevent circular references and memory leaks |
getCanvasContext | Returns a canvas context associated with the tile image (with the image drawn on it). |
{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.
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.
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 for a new OpenLayers.Tile.Image instance.
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} |
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'); }
{Boolean}
nullify references to prevent circular references and memory leaks
destroy: function()
Returns a canvas context associated with the tile image (with the image drawn on it).
getCanvasContext: function()