OpenLayers.Layer.Grid

Base class for layers that use a lattice of tiles.  Create a new grid layer with the OpenLayers.Layer.Grid constructor.

Inherits from

Summary
OpenLayers.Layer.GridBase class for layers that use a lattice of tiles.
Properties
tileSize{OpenLayers.Size}
tileOrigin{OpenLayers.LonLat} Optional origin for aligning the grid of tiles.
tileOptions{Object} optional configuration options for OpenLayers.Tile instances created by this Layer, if supported by the tile class.
singleTile{Boolean} Moves the layer into single-tile mode, meaning that one tile will be loaded.
ratio{Float} Used only when in single-tile mode, this specifies the ratio of the size of the single tile to the size of the map.
buffer{Integer} Used only when in gridded mode, this specifies the number of extra rows and colums of tiles on each side which will surround the minimum grid tiles to cover the map.
numLoadingTiles{Integer} How many tiles are still loading?
tileLoadingDelay
Constructor
OpenLayers.Layer.GridCreate a new grid layer
Functions
destroyDeconstruct the layer and clear the grid.
cloneCreate a clone of this layer
setTileSizeCheck if we are in singleTile mode and if so, set the size as a ratio of the map size (as specified by the layer’s ‘ratio’ property).
getTilesBoundsReturn the bounds of the tile grid.
addTileCreate a tile, initialize it, and add it to the layer div.
getTileBoundsReturns The tile bounds for a layer given a pixel location.

Properties

tileSize

tileOrigin

{OpenLayers.LonLat} Optional origin for aligning the grid of tiles.  If provided, requests for tiles at all resolutions will be aligned with this location (no tiles shall overlap this location).  If not provided, the grid of tiles will be aligned with the layer’s maxExtent.  Default is ``null``.

tileOptions

{Object} optional configuration options for OpenLayers.Tile instances created by this Layer, if supported by the tile class.

singleTile

{Boolean} Moves the layer into single-tile mode, meaning that one tile will be loaded.  The tile’s size will be determined by the ‘ratio’ property.  When the tile is dragged such that it does not cover the entire viewport, it is reloaded.

ratio

{Float} Used only when in single-tile mode, this specifies the ratio of the size of the single tile to the size of the map.

buffer

{Integer} Used only when in gridded mode, this specifies the number of extra rows and colums of tiles on each side which will surround the minimum grid tiles to cover the map.  For very slow loading layers, a larger value may increase performance somewhat when dragging, but will increase bandwidth use significantly.

numLoadingTiles

{Integer} How many tiles are still loading?

tileLoadingDelay

{Integer}Number of milliseconds before we shift and load tiles.  Default is 100.

Constructor

OpenLayers.Layer.Grid

Create a new grid layer

Parameters

name{String}
url{String}
params{Object}
options{Object} Hashtable of extra options to tag onto the layer

Functions

destroy

destroy: function()

Deconstruct the layer and clear the grid.

clone

clone: function (obj)

Create a clone of this layer

Parameters

obj{Object} Is this ever used?

Returns

{OpenLayers.Layer.Grid} An exact clone of this OpenLayers.Layer.Grid

setTileSize

setTileSize: function(size)

Check if we are in singleTile mode and if so, set the size as a ratio of the map size (as specified by the layer’s ‘ratio’ property).

Parameters

size{OpenLayers.Size}

getTilesBounds

getTilesBounds: function()

Return the bounds of the tile grid.

Returns

{OpenLayers.Bounds} A Bounds object representing the bounds of all the currently loaded tiles (including those partially or not at all seen onscreen).

addTile

addTile:function(bounds,
position)

Create a tile, initialize it, and add it to the layer div.

Parameters bounds - {OpenLayers.Bounds} position - {OpenLayers.Pixel}

Returns

{OpenLayers.Tile} The added OpenLayers.Tile

getTileBounds

getTileBounds: function(viewPortPx)

Returns The tile bounds for a layer given a pixel location.

Parameters

viewPortPx{OpenLayers.Pixel} The location in the viewport.

Returns

{OpenLayers.Bounds} Bounds of the tile at the given pixel location.

Instances of this class represent a width/height pair
This class represents a longitude and latitude pair
This is a class designed to designate a single tile, however it is explicitly designed to do relatively little.
destroy: function()
Deconstruct the layer and clear the grid.
clone: function (obj)
Create a clone of this layer
setTileSize: function(size)
Check if we are in singleTile mode and if so, set the size as a ratio of the map size (as specified by the layer’s ‘ratio’ property).
getTilesBounds: function()
Return the bounds of the tile grid.
addTile:function(bounds,
position)
Create a tile, initialize it, and add it to the layer div.
getTileBounds: function(viewPortPx)
Returns The tile bounds for a layer given a pixel location.
Create a new grid layer
{OpenLayers.Bounds} The center of these bounds will not stray outside of the viewport extent during panning.
Instances of this class represent bounding boxes.
This class represents a screen coordinate, in x and y coordinates
Close