# 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

- OpenLayers.Tile

Summary

OpenLayers.Tile.Image | 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.
imgDiv | {DOMElement} The div element which wraps the image.
frame | {DOMElement} The image element is appended to the frame.
layerAlphaHack | {Boolean} True if the png alpha hack needs to be applied on the layer’s div.
isBackBuffer | {Boolean} Is this tile a back buffer tile?
isFirstDraw | {Boolean} Is this the first time the tile is being drawn?
backBufferTile | {OpenLayers.Tile} A clone of the tile used to create transition effects when the tile is moved or changes resolution.
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.
Functions |
destroy | nullify references to prevent circular references and memory leaks
clone |
draw | Check that a tile should be drawn, and draw it.
resetBackBuffer | Triggered by two different events, layer loadend, and tile loadend.
renderTile | Internal function to actually initialize the image tile, position it correctly, and set its url.
positionImage | Using the properties currenty set on the layer, position the tile correctly.
clear | Clear the tile of any bounds/position-related data so that it can be reused in a new location.
initImgDiv | Creates the imgDiv property on the tile.
removeImgDiv | Removes the imgDiv from the DOM and stops listening to events on it.
checkImgURL | Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime.
startTransition | This method is invoked on tiles that are backBuffers for tiles in the grid.
show | Show the tile by showing its frame.
hide | Hide the tile by hiding its frame.

### Properties

### url

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

### imgDiv

{DOMElement} The div element which wraps the image.

### frame

{DOMElement} The image element is appended to the frame. Any gutter on the image will be hidden behind the frame.

### layerAlphaHack

{Boolean} True if the png alpha hack needs to be applied on the layer’s div.

### isBackBuffer

{Boolean} Is this tile a back buffer tile?

### isFirstDraw

{Boolean} Is this the first time the tile is being drawn? This is used to force resetBackBuffer to synchronize the backBufferTile with the foreground tile the first time the foreground tile loads so that if the user zooms before the layer has fully loaded, the backBufferTile for tiles that have been loaded can be used.

### backBufferTile

{OpenLayers.Tile} A clone of the tile used to create transition effects when the tile is moved or changes resolution.

### 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 Opera < 10.0 do not fully support this option.

#### Note

Do not use this option for layers that have a transitionEffect configured - IFrame tiles from POST requests can not be resized.

### Functions

### destroy

> destroy: function()

nullify references to prevent circular references and memory leaks

### clone

> clone: function ( | obj | )

#### Parameters

obj | {OpenLayers.Tile.Image} The tile to be cloned

#### Returns

{OpenLayers.Tile.Image} An exact clone of this OpenLayers.Tile.Image

### draw

> draw: function()

Check that a tile should be drawn, and draw it.

#### Returns

{Boolean} Always returns true.

### resetBackBuffer

> resetBackBuffer: function()

Triggered by two different events, layer loadend, and tile loadend. In any of these cases, we check to see if we can hide the backBufferTile yet and update its parameters to match the foreground tile.

#### Basic logic

- If the backBufferTile hasn’t been drawn yet, reset it
- If layer is still loading, show foreground tile but don’t hide the backBufferTile yet
- If layer is done loading, reset backBuffer tile and show foreground tile

### renderTile

> renderTile: function()

Internal function to actually initialize the image tile, position it correctly, and set its url.

### positionImage

> positionImage: function()

Using the properties currenty set on the layer, position the tile correctly. This method is used both by the async and non-async versions of the Tile.Image code.

### clear

> clear: function()

Clear the tile of any bounds/position-related data so that it can be reused in a new location.

### initImgDiv

> initImgDiv: function()

Creates the imgDiv property on the tile.

### removeImgDiv

> removeImgDiv: function()

Removes the imgDiv from the DOM and stops listening to events on it.

### checkImgURL

> checkImgURL: function ()

Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime. If the tile URL did change before the image loaded, set the imgDiv display to ‘none’, as either (a) it will be reset to visible when the new URL loads in the image, or (b) we don’t want to display this tile after all because its new bounds are outside our maxExtent.

This function should no longer be neccesary with the improvements to Grid.js in OpenLayers 2.3. The lack of a good isEquivilantURL function caused problems in 2.2, but it’s possible that with the improved isEquivilant URL function, this might be neccesary at some point.

See discussion in the thread at http://openlayers.org/pipermail/dev/2007-January/000205.html

### startTransition

> startTransition: function()

This method is invoked on tiles that are backBuffers for tiles in the grid. The grid tile is about to be cleared and a new tile source loaded. This is where the transition effect needs to be started to provide visual continuity.

### show

> show: function()

Show the tile by showing its frame.

### hide

> hide: function()

Hide the tile by hiding its frame.

This is a class designed to designate a single tile, however it is explicitly designed to do relatively little.

> destroy: function()

nullify references to prevent circular references and memory leaks

> clone: function ( | obj | )

> draw: function()

Check that a tile should be drawn, and draw it.

> resetBackBuffer: function()

Triggered by two different events, layer loadend, and tile loadend.

> renderTile: function()

Internal function to actually initialize the image tile, position it correctly, and set its url.

> positionImage: function()

Using the properties currenty set on the layer, position the tile correctly.

> clear: function()

Clear the tile of any bounds/position-related data so that it can be reused in a new location.

> initImgDiv: function()

Creates the imgDiv property on the tile.

> removeImgDiv: function()

Removes the imgDiv from the DOM and stops listening to events on it.

> checkImgURL: function ()

Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime.

> startTransition: function()

This method is invoked on tiles that are backBuffers for tiles in the grid.

> show: function()

Show the tile by showing its frame.

> hide: function()

Hide the tile by hiding its frame.
Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers.
Close