Class Layer

Hierarchy

Index

Interfaces

Classes

Constructor methods

Properties

Methods

Interfaces

TileOptions: TileOptions

optional public crossOriginKeyword?: string

WMSGetMapParams: WMSGetMapParams

optional public exceptions?: string

optional public format?: string

public layers: string

optional public service?: string

optional public styles?: string

optional public transparent?: string

optional public version?: string

WMSOptions: WMSOptions

optional public encodeBBOX?: boolean

optional public isBaseLayer?: boolean

optional public noMagic?: boolean

optional public opacity?: number

optional public singleTile?: boolean

optional public yx?: Object

Classes

ArcGIS93Rest: ArcGIS93Rest

ArcGISCache: ArcGISCache

ArcIMS: ArcIMS

Bing: Bing

Boxes: Boxes

EventPane: EventPane

FixedZoomLevels: FixedZoomLevels

GeoRSS: GeoRSS

Google: Google

v3: v3

Grid: Grid

constructor(name: string, url: string, params: {}, options: {}): Grid

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

Parameters

  • name: string
  • url: string
  • params: {}
  • options: {}

Returns

Grid

public RESOLUTION_PROPERTIES: Array<string>

The properties that are used for calculating resolutions information.

public alpha: boolean

The layer's images have an alpha channel. Default is false.

public alwaysInRange: boolean

If a layer's display should not be scale-based, this should be set to true. This will cause the layer, as an overlay, to always be 'active', by always returning true from the calculateInRange() function.

If not explicitly specified for a layer, its value will be determined on startup in initResolutions() based on whether or not any scale-specific properties have been set as options on the layer. If no scale-specific options have been set on the layer, we assume that it should always be in range.

public attribution: string

Attribution string, displayed when an has been added to the map.

public backBuffer: HTMLElement

Property: backBuffer {DOMElement} The back buffer.

public backBufferLonLat: { lon: number; lat: number; }

Property: backBufferLonLat {Object} The top-left corner of the current back buffer. Includes lon and lat properties. This object is updated each time a back buffer is created.

public backBufferLonLat.lat: number

public backBufferLonLat.lon: number

public backBufferResolution: number

Property: backBufferResolution {Number} The resolution of the current back buffer. This property is updated each time a back buffer is created.

public backBufferTimerId: number

Property: backBufferTimerId {Number} The id of the back buffer timer. This timer is used to delay the removal of the back buffer, thereby preventing flash effects caused by tile animation.

public buffer: number

APIProperty: buffer {Integer} Used only when in gridded mode, this specifies the number of extra rows and columns 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.

public className: string

APIProperty: className {String} Name of the class added to the layer div. If not set in the options passed to the constructor then className defaults to "olLayerGridSingleTile" for single tile layers (see ), and "olLayerGrid" for non single tile layers.

Note:

The displaying of tiles is not animated by default for single tile layers - OpenLayers' default theme (style.css) includes this: (code) .olLayerGrid .olTileImage { -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } (end) To animate tile displaying for any grid layer the following CSS rule can be used: (code) .olTileImage { -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } (end) In that case, to avoid flash effects, should not be zero.

public displayInLayerSwitcher: boolean

Display the layer's name in the layer switcher. Default is true

public displayOutsideMaxExtent: boolean

Request map tiles that are completely outside of the max extent for this layer. Defaults to false.

public div: HTMLElement

public eventListeners: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public events: Events

APIProperty: events {}

Register a listener for a particular event with the following syntax: (code) layer.events.register(type, obj, listener); (end)

Listeners will be called with a reference to an event object. The properties of this event depends on exactly what happened.

All event objects have at least the following properties: object - {Object} A reference to layer.events.object. element - {DOMElement} A reference to layer.events.element.

Supported map event types: loadstart - Triggered when layer loading starts. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a filter property holding the OpenLayers.Filter used when calling read on the protocol. loadend - Triggered when layer loading ends. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a response property holding an OpenLayers.Protocol.Response object. visibilitychanged - Triggered when the layer's visibility property is changed, e.g. by turning the layer on or off in the layer switcher. Note that the actual visibility of the layer can also change if it gets out of range (see ). If you also want to catch these cases, register for the map's 'changelayer' event instead. move - Triggered when layer moves (triggered with every mousemove during a drag). moveend - Triggered when layer is done moving, object passed as argument has a zoomChanged boolean property which tells that the zoom has changed. added - Triggered after the layer is added to a map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer. removed - Triggered after the layer is removed from the map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer.

public grid: Array<OpenLayers.Tile[]>

Property: grid {Array(Array())} This is an array of rows, each row is an array of tiles.

public gridLayout: { tilelon: number; tilelat: number; startcol: number; startrow: number; }

Property: gridLayout {Object} Object containing properties tilelon, tilelat, startcol, startrow

public gridLayout.startcol: number

public gridLayout.startrow: number

public gridLayout.tilelat: number

public gridLayout.tilelon: number

public gridResolution: number

Property: gridResolution {Number} The resolution of the current grid. Used for backbuffer and client zoom. This property is updated every time the grid is initialized.

public gutter: number

Determines the width (in pixels) of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. This allows artifacts of rendering at tile edges to be ignored. Set a gutter value that is equal to half the size of the widest symbol that needs to be displayed. Defaults to zero. Non-tiled layers always have zero gutter.

public id: string

public imageSize: Size

For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension.

public inRange: boolean

The current map resolution is within the layer's min/max range. This is set in whenever the zoom changes.

public isBaseLayer: boolean

Whether or not the layer is a base layer. This should be set individually by all subclasses. Default is false

public loading: boolean

Property: loading {Boolean} Indicates if tiles are being loaded.

public map: Map

This variable is set when the layer is added to the map, via the accessor function setMap()

public maxExtent: Bounds

The maximum extent for the layer. Defaults to null.

public maxResolution: number

Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. Specify a different value in the layer options if you are not using the default and displaying the whole world.

public maxScale: number

public metadata: Object

This object can be used to store additional information on a layer object.

public minExtent: Bounds

The minimum extent for the layer. Defaults to null.

public minResolution: number

public minScale: number

public name: string

public numLoadingTiles: number

APIProperty: numLoadingTiles {Integer} How many tiles are still loading?

public numZoomLevels: number

public opacity: number

The layer's opacity. Float number between 0.0 and 1.0.

public options: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public params: Object

Property: params {Object} Hashtable of key/value parameters

public projection: Projection

Specifies the projection of the layer. Can be set in the layer options. If not specified in the layer options, it is set to the default projection specified in the map, when the layer is added to the map. Projection along with default maxExtent and resolutions are set automatically with commercial baselayers in EPSG:3857, such as Google, Bing and OpenStreetMap, and do not need to be specified. Otherwise, if specifying projection, also set maxExtent, maxResolution or resolutions as appropriate. When using vector layers with strategies, layer projection should be set to the projection of the source data if that is different from the map default.

public ratio: number

APIProperty: 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. Default value is 1.5.

public removeBackBufferDelay: number

APIProperty: removeBackBufferDelay {Number} Delay for removing the backbuffer when all tiles have finished loading. Can be set to 0 when no css opacity transitions for the olTileImage class are used. Default is 0 for layers, 2500 for tiled layers. See for more information on tile animation.

public reproject: boolean

APIProperty: reproject Deprecated. See http://docs.openlayers.org/library/spherical_mercator.html for information on the replacement for this functionality. {Boolean} Whether layer should reproject itself based on base layer locations. This allows reprojection onto commercial layers. Default is false: Most layers can't reproject, but layers which can create non-square geographic pixels can, like WMS.

public resolutions: Array<any>

A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).

public rowSign: number

Property: rowSign {Number} 1 for grids starting at the top, -1 for grids starting at the bottom. This is used for several grid index and offset calculations.

public scales: Array<any>

An array of map scales in descending order. The values in the array correspond to the map scale denominator. Note that these values only make sense if the display (monitor) resolution of the client is correctly guessed by whomever is configuring the application. In addition, the units property must also be set. Use instead wherever possible.

public serverResolutions: Array<number>

Property: serverResolutions {Array(Number}} This property is documented in subclasses as an API property.

public singleTile: boolean

APIProperty: 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.

public tileClass: Tile

APIProperty: tileClass {} The tile class to use for this layer. Defaults is OpenLayers.Tile.Image.

public tileOptions: Object

APIProperty: tileOptions {Object} optional configuration options for instances created by this Layer, if supported by the tile class.

public tileOrigin: LonLat

APIProperty: tileOrigin {} 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

. Default is null.

public tileOriginCorner: string

Property: tileOriginCorner {String} If the property is not provided, the tile origin will be derived from the layer's . The corner of the

used is determined by this property. Acceptable values are "tl" (top left), "tr" (top right), "bl" (bottom left), and "br" (bottom right). Default is "bl".

public tileSize: Size

APIProperty: tileSize {}

public transitionEffect: string

APIProperty: transitionEffect {String} The transition effect to use when the map is zoomed. Two posible values:

"resize" - Existing tiles are resized on zoom to provide a visual effect of the zoom having taken place immediately. As the new tiles become available, they are drawn on top of the resized tiles (this is the default setting). "map-resize" - Existing tiles are resized on zoom and placed below the base layer. New tiles for the base layer will cover existing tiles. This setting is recommended when having an overlay duplicated during the transition is undesirable (e.g. street labels or big transparent fills). null - No transition effect.

Using "resize" on non-opaque layers can cause undesired visual effects. Set transitionEffect to null in this case.

public transitionendEvents: Array<string>

Property: transitionendEvents {Array} Event names for transitionend

public units: string

The layer map units. Defaults to null. Possible values are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.

public url: Array<string>

Property: url {Array(String) or String} This is either an array of url strings or a single url string.

public visibility: boolean

The layer should be displayed in the map. Default is true.

public wrapDateLine: boolean

Wraps the world at the international dateline, so the map can be panned infinitely in longitudinal direction. Only use this on the base layer, and only if the layer's maxExtent equals the world bounds.

public addOptions(newOptions: {}, reinitialize: boolean)

APIMethod: addOptions

Parameters: newOptions - {Object} reinitialize - {Boolean} If set to true, and if resolution options of the current baseLayer were changed, the map will be recentered to make sure that it is displayed with a valid resolution, and a changebaselayer event will be triggered.

Parameters

  • newOptions: {}
  • reinitialize: boolean

public addTile(bounds: Bounds, position: number): Tile

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

Parameters bounds - {} position - {}

Returns: {} The added OpenLayers.Tile

Parameters

  • bounds: Bounds
  • position: number

Returns

Tile

private addTileMonitoringHooks(tile: Tile)

Method: addTileMonitoringHooks This function takes a tile as input and adds the appropriate hooks to the tile so that the layer can keep track of the loading tiles.

Parameters: tile - {}

Parameters

public adjustBounds(bounds: Bounds): Bounds

Method: adjustBounds This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right.

Parameters: bounds - {}

Parameters

Returns

Bounds

private applyBackBuffer(resolution: number)

Method: applyBackBuffer Create, insert, scale and position a back buffer for the layer.

Parameters: resolution - {Number} The resolution to transition to.

Parameters

  • resolution: number

private calculateGridLayout(bounds: Bounds, origin: LonLat, resolution: number): { tilelon: number; tilelat: number; startcol: number; startrow: number; }

Method: calculateGridLayout Generate parameters for the grid layout.

Parameters: bounds - {|Object} OpenLayers.Bounds or an object with a 'left' and 'top' properties. origin - {|Object} OpenLayers.LonLat or an object with a 'lon' and 'lat' properties. resolution - {Number}

Returns: {Object} Object containing properties tilelon, tilelat, startcol, startrow

Parameters

Returns

{ tilelon: number; tilelat: number; startcol: number; startrow: number; }

public calculateInRange(): boolean

APIMethod: calculateInRange

Returns: {Boolean} The layer is displayable at the current map's current resolution. Note that if 'alwaysInRange' is true for the layer, this function will always return true.

Returns

boolean

public calculateResolutions(props: Object): Array<number>

Method: calculateResolutions Calculate resolutions based on the provided properties.

Parameters: props - {Object} Properties

Returns: {Array({Number})} Array of resolutions.

Parameters

  • props: Object

Returns

Array<number>

private clearGrid()

Method: clearGrid Go through and remove all tiles from the grid, calling destroy() on each of them to kill circular references

public clone(obj?: Object): Grid

APIMethod: clone Create a clone of this layer

Parameters: obj - {Object} Is this ever used?

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

Parameters

  • obj?: Object optional

Returns

Grid

private createBackBuffer(): HTMLElement

Method: createBackBuffer Create a back buffer.

Returns: {DOMElement} The DOM element for the back buffer, undefined if the grid isn't initialized yet.

Returns

HTMLElement

public destroy()

APIMethod: destroy Deconstruct the layer and clear the grid.

private destroyTile(tile: Tile)

Method: destroyTile

Parameters: tile - {}

Parameters

public display(display: boolean)

APIMethod: display Hide or show the Layer. This is designed to be used internally, and is not generally the way to enable or disable the layer. For that, use the setVisibility function instead..

Parameters: display - {Boolean}

Parameters

  • display: boolean

public getExtent(): Bounds

APIMethod: getExtent

Returns: {} A Bounds object which represents the lon/lat bounds of the current viewPort.

Returns

Bounds

public getFullRequestString(newParams: Object, altUrl: string): string

Method: getFullRequestString Combine url with layer's params and these newParams.

does checking on the serverPath variable, allowing for cases when it is supplied with trailing ? or &, as well as cases where not.

return in formatted string like this: "server?key1=value1&key2=value2&key3=value3"

WARNING: The altUrl parameter is deprecated and will be removed in 3.0.

Parameters: newParams - {Object} altUrl - {String} Use this as the url instead of the layer's url

Returns: {String}

Parameters

  • newParams: Object
  • altUrl: string

Returns

string

public getImageSize(): Size

Returns

Size

public getLonLatFromViewPortPx(viewPortPx: Pixel): LonLat

APIMethod: getLonLatFromViewPortPx

Parameters: viewPortPx - {|Object} An OpenLayers.Pixel or an object with a 'x' and 'y' properties.

Returns: {} An OpenLayers.LonLat which is the passed-in view port , translated into lon/lat by the layer.

Parameters

Returns

LonLat

private getMaxExtent(): Bounds

Method: getMaxExtent Get this layer's maximum extent. (Implemented as a getter for potential specific implementations in sub-classes.)

Returns: {}

Returns

Bounds

public getResolution(): number

APIMethod: getResolution

Returns: {Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level.

Returns

number

public getResolutionForZoom(zoom: number): number

APIMethod: getResolutionForZoom

Parameters: zoom - {Float}

Returns: {Float} A suitable resolution for the specified zoom.

Parameters

  • zoom: number

Returns

number

private getServerResolution(resolution: number): number

Method: getServerResolution Return the closest server-supported resolution.

Parameters: resolution - {Number} The base resolution. If undefined the map resolution is used.

Returns: {Number} The closest server resolution value.

Parameters

  • resolution: number

Returns

number

private getServerZoom(): number

Method: getServerZoom Return the zoom value corresponding to the best matching server resolution, taking into account and .

Returns: {Number} The closest server supported zoom. This is not the map zoom level, but an index of the server's resolutions array.

Returns

number

public getTileBounds(viewPortPx: Pixel): Bounds

APIMethod: getTileBounds Returns The tile bounds for a layer given a pixel location.

Parameters: viewPortPx - {} The location in the viewport.

Returns: {} Bounds of the tile at the given pixel location.

Parameters

Returns

Bounds

private getTileBoundsForGridIndex(row: number, col: number): Bounds

Method: getTileBoundsForGridIndex

Parameters: row - {Number} The row of the grid col - {Number} The column of the grid

Returns: {} The bounds for the tile at (row, col)

Parameters

  • row: number
  • col: number

Returns

Bounds

private getTileData(loc: LonLat): { tile: OpenLayers.Tile; i: number; j: number; }

Method: getTileData Given a map location, retrieve a tile and the pixel offset within that tile corresponding to the location. If there is not an existing tile in the grid that covers the given location, null will be returned.

Parameters: loc - {} map location

Returns: {Object} Object with the following properties: tile ({}), i ({Number} x-pixel offset from top left), and j ({Integer} y-pixel offset from top left).

Parameters

Returns

{ tile: OpenLayers.Tile; i: number; j: number; }

private getTileOrigin(): LonLat

Method: getTileOrigin Determine the origin for aligning the grid of tiles. If a property is supplied, that will be returned. Otherwise, the origin will be derived from the layer's property. In this case, the tile origin will be the corner of the given by the

property.

Returns: {} The tile origin.

Returns

LonLat

public getTilesBounds(): Bounds

APIMethod: getTilesBounds Return the bounds of the tile grid.

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

Returns

Bounds

public getViewPortPxFromLonLat(lonlat: LonLat, resolution: number): Pixel

APIMethod: getViewPortPxFromLonLat Returns a pixel location given a map location. This method will return fractional pixel values.

Parameters: lonlat - {|Object} An OpenLayers.LonLat or an object with a 'lon' and 'lat' properties.

Returns: {} An which is the passed-in lonlat translated into view port pixels.

Parameters

  • lonlat: LonLat
  • resolution: number

Returns

Pixel

public getVisibility(): boolean

APIMethod: getVisibility

Returns: {Boolean} The layer should be displayed (if in range).

Returns

boolean

public getZIndex(): number

Method: getZIndex

Returns: {Integer} the z-index of this layer

Returns

number

public getZoomForExtent(extent: Bounds, closest?: boolean): number

APIMethod: getZoomForExtent

Parameters: extent - {} closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) for the passed-in extent. We do this by calculating the ideal resolution for the given extent (based on the map size) and then calling getZoomForResolution(), passing along the 'closest' parameter.

Parameters

  • extent: Bounds
  • closest?: boolean optional

Returns

number

public getZoomForResolution(resolution: number, closest?: boolean): number

APIMethod: getZoomForResolution

Parameters: resolution - {Float} closest - {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it'll be close). Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification.

Parameters

  • resolution: number
  • closest?: boolean optional

Returns

number

private initGriddedTiles(bounds: Bounds)

Method: initGriddedTiles

Parameters: bounds - {}

Parameters

private initProperties()

Method: initProperties Set any properties that depend on the value of singleTile. Currently sets removeBackBufferDelay and className

public initResolutions()

Method: initResolutions This method's responsibility is to set up the 'resolutions' array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer.

The user has several options that determine how the array is set up.

For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels

private initSingleTile(bounds: Bounds): any

Method: initSingleTile

Parameters: bounds - {}

Parameters

Returns

any

public mergeNewParams(newParams: Object): boolean

APIMethod: mergeNewParams

Parameters: newParams - {Object}

Returns: redrawn: {Boolean} whether the layer was actually redrawn.

Parameters

  • newParams: Object

Returns

boolean

public moveByPx(dx: number, dy: number)

Method: moveByPx Move the layer based on pixel vector.

Parameters: dx - {Number} dy - {Number}

Parameters

  • dx: number
  • dy: number

private moveGriddedTiles()

Method: moveGriddedTiles

public moveTo(bounds: Bounds, zoomChanged: boolean, dragging: boolean)

Method: moveTo This function is called whenever the map is moved. All the moving of actual 'tiles' is done by the map, but moveTo's role is to accept a bounds and make sure the data that that bounds requires is pre-loaded.

Parameters: bounds - {} zoomChanged - {Boolean} dragging - {Boolean}

Parameters

  • bounds: Bounds
  • zoomChanged: boolean
  • dragging: boolean

public onMapResize()

Method: onMapResize For singleTile layers, this will set a new tile size according to the dimensions of the map pane.

public redraw(force?: boolean): boolean

APIMethod: redraw Redraws the layer. Returns true if the layer was redrawn, false if not.

Parameters: force - {Boolean} Force redraw by adding random parameter.

Returns: {Boolean} The layer was redrawn.

Parameters

  • force?: boolean optional

Returns

boolean

private removeBackBuffer()

Method: removeBackBuffer Remove back buffer from DOM.

private removeExcessTiles(rows: number, columns: number)

Method: removeExcessTiles When the size of the map or the buffer changes, we may need to remove some excess rows and columns.

Parameters: rows - {Integer} Maximum number of rows we want our grid to have. columns - {Integer} Maximum number of columns we want our grid to have.

Parameters

  • rows: number
  • columns: number

public removeMap(map: Map)

Method: removeMap Called when the layer is removed from the map.

Parameters: map - {} The map.

Parameters

private removeTileMonitoringHooks(tile: Tile)

Method: removeTileMonitoringHooks This function takes a tile as input and removes the tile hooks that were added in addTileMonitoringHooks()

Parameters: tile - {}

Parameters

public setIsBaseLayer(isBaseLayer: boolean)

APIMethod: setIsBaseLayer

Parameters: isBaseLayer - {Boolean}

Parameters

  • isBaseLayer: boolean

public setMap(map: Map)

Method: setMap

Parameters: map - {} The map.

Parameters

public setName(newName: string)

APIMethod: setName Sets the new layer name for this layer. Can trigger a changelayer event on the map.

Parameters: newName - {String} The new name.

Parameters

  • newName: string

public setOpacity(opacity: number)

APIMethod: setOpacity Sets the opacity for the entire layer (all images)

Parameters: opacity - {Float}

Parameters

  • opacity: number

public setTileSize(size: Size)

APIMethod: setTileSize 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 - {}

Parameters

public setUrl(newUrl: string)

APIMethod: setUrl

Parameters: newUrl - {String}

Parameters

  • newUrl: string

public setVisibility(visibility: boolean)

APIMethod: setVisibility Set the visibility flag for the layer and hide/show & redraw accordingly. Fire event unless otherwise specified

Note that visibility is no longer simply whether or not the layer's style.display is set to "block". Now we store a 'visibility' state property on the layer class, this allows us to remember whether or not we desire for a layer to be visible. In the case where the map's resolution is out of the layer's range, this desire may be subverted.

Parameters: visibility - {Boolean} Whether or not to display the layer (if in range)

Parameters

  • visibility: boolean

public setZIndex(zIndex: number)

Method: setZIndex

Parameters: zIndex - {Integer}

Parameters

  • zIndex: number

private shiftColumn(prepend: boolean, tileSize: { w: number; h: number; })

Method: shiftColumn Shift grid work in the other dimension

Parameters: prepend - {Boolean} if true, prepend to beginning. if false, then append to end tileSize - {Object} rendered tile size; object with w and h properties

Parameters

  • prepend: boolean
  • tileSize: { w: number; h: number; }

private shiftRow(prepend: boolean, tileSize: { w: number; h: number; })

Method: shiftRow Shifty grid work

Parameters: prepend - {Boolean} if true, prepend to beginning. if false, then append to end tileSize - {Object} rendered tile size; object with w and h properties

Parameters

  • prepend: boolean
  • tileSize: { w: number; h: number; }

HTTPRequest: HTTPRequest

constructor(name: string, url: string, params: Object, options: Object): HTTPRequest

Constructor: OpenLayers.Layer.HTTPRequest

Parameters: name - {String} url - {Array(String) or String} params - {Object} options - {Object} Hashtable of extra options to tag onto the layer

Parameters

  • name: string
  • url: string
  • params: Object
  • options: Object

Returns

HTTPRequest

constructor(name: string, url: Array<string>, params: Object, options: Object): HTTPRequest

Parameters

  • name: string
  • url: Array<string>
  • params: Object
  • options: Object

Returns

HTTPRequest

public RESOLUTION_PROPERTIES: Array<string>

The properties that are used for calculating resolutions information.

public static URL_HASH_FACTOR: number

Constant: URL_HASH_FACTOR {Float} Used to hash URL param strings for multi-WMS server selection. Set to the Golden Ratio per Knuth's recommendation.

public alpha: boolean

The layer's images have an alpha channel. Default is false.

public alwaysInRange: boolean

If a layer's display should not be scale-based, this should be set to true. This will cause the layer, as an overlay, to always be 'active', by always returning true from the calculateInRange() function.

If not explicitly specified for a layer, its value will be determined on startup in initResolutions() based on whether or not any scale-specific properties have been set as options on the layer. If no scale-specific options have been set on the layer, we assume that it should always be in range.

public attribution: string

Attribution string, displayed when an has been added to the map.

public displayInLayerSwitcher: boolean

Display the layer's name in the layer switcher. Default is true

public displayOutsideMaxExtent: boolean

Request map tiles that are completely outside of the max extent for this layer. Defaults to false.

public div: HTMLElement

public eventListeners: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public events: Events

APIProperty: events {}

Register a listener for a particular event with the following syntax: (code) layer.events.register(type, obj, listener); (end)

Listeners will be called with a reference to an event object. The properties of this event depends on exactly what happened.

All event objects have at least the following properties: object - {Object} A reference to layer.events.object. element - {DOMElement} A reference to layer.events.element.

Supported map event types: loadstart - Triggered when layer loading starts. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a filter property holding the OpenLayers.Filter used when calling read on the protocol. loadend - Triggered when layer loading ends. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a response property holding an OpenLayers.Protocol.Response object. visibilitychanged - Triggered when the layer's visibility property is changed, e.g. by turning the layer on or off in the layer switcher. Note that the actual visibility of the layer can also change if it gets out of range (see ). If you also want to catch these cases, register for the map's 'changelayer' event instead. move - Triggered when layer moves (triggered with every mousemove during a drag). moveend - Triggered when layer is done moving, object passed as argument has a zoomChanged boolean property which tells that the zoom has changed. added - Triggered after the layer is added to a map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer. removed - Triggered after the layer is removed from the map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer.

public gutter: number

Determines the width (in pixels) of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. This allows artifacts of rendering at tile edges to be ignored. Set a gutter value that is equal to half the size of the widest symbol that needs to be displayed. Defaults to zero. Non-tiled layers always have zero gutter.

public id: string

public imageSize: Size

For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension.

public inRange: boolean

The current map resolution is within the layer's min/max range. This is set in whenever the zoom changes.

public isBaseLayer: boolean

Whether or not the layer is a base layer. This should be set individually by all subclasses. Default is false

public map: Map

This variable is set when the layer is added to the map, via the accessor function setMap()

public maxExtent: Bounds

The maximum extent for the layer. Defaults to null.

public maxResolution: number

Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. Specify a different value in the layer options if you are not using the default and displaying the whole world.

public maxScale: number

public metadata: Object

This object can be used to store additional information on a layer object.

public minExtent: Bounds

The minimum extent for the layer. Defaults to null.

public minResolution: number

public minScale: number

public name: string

public numZoomLevels: number

public opacity: number

The layer's opacity. Float number between 0.0 and 1.0.

public options: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public params: Object

Property: params {Object} Hashtable of key/value parameters

public projection: Projection

Specifies the projection of the layer. Can be set in the layer options. If not specified in the layer options, it is set to the default projection specified in the map, when the layer is added to the map. Projection along with default maxExtent and resolutions are set automatically with commercial baselayers in EPSG:3857, such as Google, Bing and OpenStreetMap, and do not need to be specified. Otherwise, if specifying projection, also set maxExtent, maxResolution or resolutions as appropriate. When using vector layers with strategies, layer projection should be set to the projection of the source data if that is different from the map default.

public reproject: boolean

APIProperty: reproject Deprecated. See http://docs.openlayers.org/library/spherical_mercator.html for information on the replacement for this functionality. {Boolean} Whether layer should reproject itself based on base layer locations. This allows reprojection onto commercial layers. Default is false: Most layers can't reproject, but layers which can create non-square geographic pixels can, like WMS.

public resolutions: Array<any>

A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).

public scales: Array<any>

An array of map scales in descending order. The values in the array correspond to the map scale denominator. Note that these values only make sense if the display (monitor) resolution of the client is correctly guessed by whomever is configuring the application. In addition, the units property must also be set. Use instead wherever possible.

public units: string

The layer map units. Defaults to null. Possible values are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.

public url: Array<string>

Property: url {Array(String) or String} This is either an array of url strings or a single url string.

public visibility: boolean

The layer should be displayed in the map. Default is true.

public wrapDateLine: boolean

Wraps the world at the international dateline, so the map can be panned infinitely in longitudinal direction. Only use this on the base layer, and only if the layer's maxExtent equals the world bounds.

public addOptions(newOptions: LayerOptions, reinitialize: boolean)

APIMethod: addOptions

Parameters: newOptions - {Object} reinitialize - {Boolean} If set to true, and if resolution options of the current baseLayer were changed, the map will be recentered to make sure that it is displayed with a valid resolution, and a changebaselayer event will be triggered.

Parameters

public adjustBounds(bounds: Bounds): Bounds

Method: adjustBounds This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right.

Parameters: bounds - {}

Parameters

Returns

Bounds

public calculateInRange(): boolean

APIMethod: calculateInRange

Returns: {Boolean} The layer is displayable at the current map's current resolution. Note that if 'alwaysInRange' is true for the layer, this function will always return true.

Returns

boolean

public calculateResolutions(props: Object): Array<number>

Method: calculateResolutions Calculate resolutions based on the provided properties.

Parameters: props - {Object} Properties

Returns: {Array({Number})} Array of resolutions.

Parameters

  • props: Object

Returns

Array<number>

public clone(obj?: Object): HTTPRequest

APIMethod: clone

Parameters: obj - {Object}

Returns: {} An exact clone of this

Parameters

  • obj?: Object optional

Returns

HTTPRequest

public destroy()

APIMethod: destroy

public display(display: boolean)

APIMethod: display Hide or show the Layer. This is designed to be used internally, and is not generally the way to enable or disable the layer. For that, use the setVisibility function instead..

Parameters: display - {Boolean}

Parameters

  • display: boolean

public getExtent(): Bounds

APIMethod: getExtent

Returns: {} A Bounds object which represents the lon/lat bounds of the current viewPort.

Returns

Bounds

public getFullRequestString(newParams: Object, altUrl: string): string

Method: getFullRequestString Combine url with layer's params and these newParams.

does checking on the serverPath variable, allowing for cases when it is supplied with trailing ? or &, as well as cases where not.

return in formatted string like this: "server?key1=value1&key2=value2&key3=value3"

WARNING: The altUrl parameter is deprecated and will be removed in 3.0.

Parameters: newParams - {Object} altUrl - {String} Use this as the url instead of the layer's url

Returns: {String}

Parameters

  • newParams: Object
  • altUrl: string

Returns

string

public getImageSize(bounds: Bounds): Size

APIMethod: getImageSize

Parameters: bounds - {} optional tile bounds, can be used by subclasses that have to deal with different tile sizes at the layer extent edges (e.g. Zoomify)

Returns: {} The size that the image should be, taking into account gutters.

Parameters

Returns

Size

public getLonLatFromViewPortPx(viewPortPx: Pixel): LonLat

APIMethod: getLonLatFromViewPortPx

Parameters: viewPortPx - {|Object} An OpenLayers.Pixel or an object with a 'x' and 'y' properties.

Returns: {} An OpenLayers.LonLat which is the passed-in view port , translated into lon/lat by the layer.

Parameters

Returns

LonLat

public getResolution(): number

APIMethod: getResolution

Returns: {Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level.

Returns

number

public getResolutionForZoom(zoom: number): number

APIMethod: getResolutionForZoom

Parameters: zoom - {Float}

Returns: {Float} A suitable resolution for the specified zoom.

Parameters

  • zoom: number

Returns

number

public getViewPortPxFromLonLat(lonlat: LonLat, resolution: number): Pixel

APIMethod: getViewPortPxFromLonLat Returns a pixel location given a map location. This method will return fractional pixel values.

Parameters: lonlat - {|Object} An OpenLayers.LonLat or an object with a 'lon' and 'lat' properties.

Returns: {} An which is the passed-in lonlat translated into view port pixels.

Parameters

  • lonlat: LonLat
  • resolution: number

Returns

Pixel

public getVisibility(): boolean

APIMethod: getVisibility

Returns: {Boolean} The layer should be displayed (if in range).

Returns

boolean

public getZIndex(): number

Method: getZIndex

Returns: {Integer} the z-index of this layer

Returns

number

public getZoomForExtent(extent: Bounds, closest?: boolean): number

APIMethod: getZoomForExtent

Parameters: extent - {} closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) for the passed-in extent. We do this by calculating the ideal resolution for the given extent (based on the map size) and then calling getZoomForResolution(), passing along the 'closest' parameter.

Parameters

  • extent: Bounds
  • closest?: boolean optional

Returns

number

public getZoomForResolution(resolution: number, closest?: boolean): number

APIMethod: getZoomForResolution

Parameters: resolution - {Float} closest - {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it'll be close). Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification.

Parameters

  • resolution: number
  • closest?: boolean optional

Returns

number

public initResolutions()

Method: initResolutions This method's responsibility is to set up the 'resolutions' array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer.

The user has several options that determine how the array is set up.

For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels

public mergeNewParams(newParams: Object): boolean

APIMethod: mergeNewParams

Parameters: newParams - {Object}

Returns: redrawn: {Boolean} whether the layer was actually redrawn.

Parameters

  • newParams: Object

Returns

boolean

public moveByPx(dx: number, dy: number)

Method: moveByPx Move the layer based on pixel vector. To be implemented by subclasses.

Parameters: dx - {Number} The x coord of the displacement vector. dy - {Number} The y coord of the displacement vector.

Parameters

  • dx: number
  • dy: number

public moveTo(bounds: Bounds, zoomChanged: boolean, dragging: boolean)

Method: moveTo

Parameters: bounds - {} zoomChanged - {Boolean} Tells when zoom has changed, as layers have to do some init work in that case. dragging - {Boolean}

Parameters

  • bounds: Bounds
  • zoomChanged: boolean
  • dragging: boolean

public onMapResize()

This function can be implemented by subclasses

public redraw(force?: boolean): boolean

APIMethod: redraw Redraws the layer. Returns true if the layer was redrawn, false if not.

Parameters: force - {Boolean} Force redraw by adding random parameter.

Returns: {Boolean} The layer was redrawn.

Parameters

  • force?: boolean optional

Returns

boolean

public removeMap(map: Map)

APIMethod: removeMap Just as setMap() allows each layer the possibility to take a personalized action on being added to the map, removeMap() allows each layer to take a personalized action on being removed from it. For now, this will be mostly unused, except for the EventPane layer, which needs this hook so that it can remove the special invisible pane.

Parameters: map - {}

Parameters

private selectUrl(paramString: string, urls: Array<string>): string

Method: selectUrl selectUrl() implements the standard floating-point multiplicative hash function described by Knuth, and hashes the contents of the given param string into a float between 0 and 1. This float is then scaled to the size of the provided urls array, and used to select a URL.

Parameters: paramString - {String} urls - {Array(String)}

Returns: {String} An entry from the urls array, deterministically selected based on the paramString.

Parameters

  • paramString: string
  • urls: Array<string>

Returns

string

public setIsBaseLayer(isBaseLayer: boolean)

APIMethod: setIsBaseLayer

Parameters: isBaseLayer - {Boolean}

Parameters

  • isBaseLayer: boolean

public setMap(map: Map)

Method: setMap Set the map property for the layer. This is done through an accessor so that subclasses can override this and take special action once they have their map variable set.

Here we take care to bring over any of the necessary default properties from the map.

Parameters: map - {}

Parameters

public setName(newName: string)

APIMethod: setName Sets the new layer name for this layer. Can trigger a changelayer event on the map.

Parameters: newName - {String} The new name.

Parameters

  • newName: string

public setOpacity(opacity: number)

APIMethod: setOpacity Sets the opacity for the entire layer (all images)

Parameters: opacity - {Float}

Parameters

  • opacity: number

public setTileSize(size: Size)

APIMethod: setTileSize Set the tile size based on the map size. This also sets layer.imageSize or use by Tile.Image.

Parameters: size - {}

Parameters

public setUrl(newUrl: string)

APIMethod: setUrl

Parameters: newUrl - {String}

Parameters

  • newUrl: string

public setVisibility(visibility: boolean)

APIMethod: setVisibility Set the visibility flag for the layer and hide/show & redraw accordingly. Fire event unless otherwise specified

Note that visibility is no longer simply whether or not the layer's style.display is set to "block". Now we store a 'visibility' state property on the layer class, this allows us to remember whether or not we desire for a layer to be visible. In the case where the map's resolution is out of the layer's range, this desire may be subverted.

Parameters: visibility - {Boolean} Whether or not to display the layer (if in range)

Parameters

  • visibility: boolean

public setZIndex(zIndex: number)

Method: setZIndex

Parameters: zIndex - {Integer}

Parameters

  • zIndex: number

Image: Image

KaMap: KaMap

KaMapCache: KaMapCache

MapGuide: MapGuide

MapServer: MapServer

Markers: Markers

OSM: OSM

constructor(): OSM

Returns

OSM

constructor(name: string, url: string, options: TileOptions): OSM

Parameters

Returns

OSM

public static CLASS_NAME: string

public RESOLUTION_PROPERTIES: Array<string>

The properties that are used for calculating resolutions information.

public alpha: boolean

The layer's images have an alpha channel. Default is false.

public alwaysInRange: boolean

If a layer's display should not be scale-based, this should be set to true. This will cause the layer, as an overlay, to always be 'active', by always returning true from the calculateInRange() function.

If not explicitly specified for a layer, its value will be determined on startup in initResolutions() based on whether or not any scale-specific properties have been set as options on the layer. If no scale-specific options have been set on the layer, we assume that it should always be in range.

public attribution: string

The layer attribution.

public backBuffer: HTMLElement

Property: backBuffer {DOMElement} The back buffer.

public backBufferLonLat: { lon: number; lat: number; }

Property: backBufferLonLat {Object} The top-left corner of the current back buffer. Includes lon and lat properties. This object is updated each time a back buffer is created.

public backBufferLonLat.lat: number

public backBufferLonLat.lon: number

public backBufferResolution: number

Property: backBufferResolution {Number} The resolution of the current back buffer. This property is updated each time a back buffer is created.

public backBufferTimerId: number

Property: backBufferTimerId {Number} The id of the back buffer timer. This timer is used to delay the removal of the back buffer, thereby preventing flash effects caused by tile animation.

public buffer: number

APIProperty: buffer {Integer} Used only when in gridded mode, this specifies the number of extra rows and columns 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.

public className: string

APIProperty: className {String} Name of the class added to the layer div. If not set in the options passed to the constructor then className defaults to "olLayerGridSingleTile" for single tile layers (see ), and "olLayerGrid" for non single tile layers.

Note:

The displaying of tiles is not animated by default for single tile layers - OpenLayers' default theme (style.css) includes this: (code) .olLayerGrid .olTileImage { -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } (end) To animate tile displaying for any grid layer the following CSS rule can be used: (code) .olTileImage { -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } (end) In that case, to avoid flash effects, should not be zero.

public displayInLayerSwitcher: boolean

Display the layer's name in the layer switcher. Default is true

public displayOutsideMaxExtent: boolean

Request map tiles that are completely outside of the max extent for this layer. Defaults to false.

public div: HTMLElement

public eventListeners: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public events: Events

APIProperty: events {}

Register a listener for a particular event with the following syntax: (code) layer.events.register(type, obj, listener); (end)

Listeners will be called with a reference to an event object. The properties of this event depends on exactly what happened.

All event objects have at least the following properties: object - {Object} A reference to layer.events.object. element - {DOMElement} A reference to layer.events.element.

Supported map event types: loadstart - Triggered when layer loading starts. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a filter property holding the OpenLayers.Filter used when calling read on the protocol. loadend - Triggered when layer loading ends. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a response property holding an OpenLayers.Protocol.Response object. visibilitychanged - Triggered when the layer's visibility property is changed, e.g. by turning the layer on or off in the layer switcher. Note that the actual visibility of the layer can also change if it gets out of range (see ). If you also want to catch these cases, register for the map's 'changelayer' event instead. move - Triggered when layer moves (triggered with every mousemove during a drag). moveend - Triggered when layer is done moving, object passed as argument has a zoomChanged boolean property which tells that the zoom has changed. added - Triggered after the layer is added to a map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer. removed - Triggered after the layer is removed from the map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer.

public grid: Array<OpenLayers.Tile[]>

Property: grid {Array(Array())} This is an array of rows, each row is an array of tiles.

public gridLayout: { tilelon: number; tilelat: number; startcol: number; startrow: number; }

Property: gridLayout {Object} Object containing properties tilelon, tilelat, startcol, startrow

public gridLayout.startcol: number

public gridLayout.startrow: number

public gridLayout.tilelat: number

public gridLayout.tilelon: number

public gridResolution: number

Property: gridResolution {Number} The resolution of the current grid. Used for backbuffer and client zoom. This property is updated every time the grid is initialized.

public gutter: number

Determines the width (in pixels) of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. This allows artifacts of rendering at tile edges to be ignored. Set a gutter value that is equal to half the size of the widest symbol that needs to be displayed. Defaults to zero. Non-tiled layers always have zero gutter.

public id: string

public imageSize: Size

For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension.

public inRange: boolean

The current map resolution is within the layer's min/max range. This is set in whenever the zoom changes.

public isBaseLayer: boolean

APIProperty: isBaseLayer Default is true, as this is designed to be a base tile source.

public loading: boolean

Property: loading {Boolean} Indicates if tiles are being loaded.

public map: Map

This variable is set when the layer is added to the map, via the accessor function setMap()

public maxExtent: Bounds

The maximum extent for the layer. Defaults to null.

public maxResolution: number

Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. Specify a different value in the layer options if you are not using the default and displaying the whole world.

public maxScale: number

public metadata: Object

This object can be used to store additional information on a layer object.

public minExtent: Bounds

The minimum extent for the layer. Defaults to null.

public minResolution: number

public minScale: number

public name: string

The layer name. Defaults to "OpenStreetMap" if the first argument to the constructor is null or undefined.

public numLoadingTiles: number

APIProperty: numLoadingTiles {Integer} How many tiles are still loading?

public numZoomLevels: number

public opacity: number

The layer's opacity. Float number between 0.0 and 1.0.

public options: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public params: Object

Property: params {Object} Hashtable of key/value parameters

public projection: Projection

Specifies the projection of the layer. Can be set in the layer options. If not specified in the layer options, it is set to the default projection specified in the map, when the layer is added to the map. Projection along with default maxExtent and resolutions are set automatically with commercial baselayers in EPSG:3857, such as Google, Bing and OpenStreetMap, and do not need to be specified. Otherwise, if specifying projection, also set maxExtent, maxResolution or resolutions as appropriate. When using vector layers with strategies, layer projection should be set to the projection of the source data if that is different from the map default.

public ratio: number

APIProperty: 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. Default value is 1.5.

public removeBackBufferDelay: number

APIProperty: removeBackBufferDelay {Number} Delay for removing the backbuffer when all tiles have finished loading. Can be set to 0 when no css opacity transitions for the olTileImage class are used. Default is 0 for layers, 2500 for tiled layers. See for more information on tile animation.

public reproject: boolean

APIProperty: reproject Deprecated. See http://docs.openlayers.org/library/spherical_mercator.html for information on the replacement for this functionality. {Boolean} Whether layer should reproject itself based on base layer locations. This allows reprojection onto commercial layers. Default is false: Most layers can't reproject, but layers which can create non-square geographic pixels can, like WMS.

public resolutions: Array<any>

A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).

public rowSign: number

Property: rowSign {Number} 1 for grids starting at the top, -1 for grids starting at the bottom. This is used for several grid index and offset calculations.

public scales: Array<any>

An array of map scales in descending order. The values in the array correspond to the map scale denominator. Note that these values only make sense if the display (monitor) resolution of the client is correctly guessed by whomever is configuring the application. In addition, the units property must also be set. Use instead wherever possible.

public serverResolutions: Array<number>

APIProperty: serverResolutions {Array} A list of all resolutions available on the server. Only set this property if the map resolutions differ from the server. This property serves two purposes. (a) can include resolutions that the server supports and that you don't want to provide with this layer; you can also look at , which is an alternative to for that specific purpose. (b) The map can work with resolutions that aren't supported by the server, i.e. that aren't in . When the map is displayed in such a resolution data for the closest server-supported resolution is loaded and the layer div is stretched as necessary.

public singleTile: boolean

APIProperty: 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.

public sphericalMercator: boolean

APIProperty: sphericalMercator Whether the tile extents should be set to the defaults for spherical mercator. Useful for things like OpenStreetMap. Default is false, except for the OSM subclass.

public tileClass: Tile

APIProperty: tileClass {} The tile class to use for this layer. Defaults is OpenLayers.Tile.Image.

public tileOptions: TileOptions

optional configuration options for instances created by this Layer.

public tileOrigin: LonLat

APIProperty: tileOrigin {} 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

. Default is null.

public tileOriginCorner: string

Property: tileOriginCorner {String} If the property is not provided, the tile origin will be derived from the layer's . The corner of the

used is determined by this property. Acceptable values are "tl" (top left), "tr" (top right), "bl" (bottom left), and "br" (bottom right). Default is "bl".

public tileSize: Size

APIProperty: tileSize {}

public transitionEffect: string

APIProperty: transitionEffect {String} The transition effect to use when the map is zoomed. Two posible values:

"resize" - Existing tiles are resized on zoom to provide a visual effect of the zoom having taken place immediately. As the new tiles become available, they are drawn on top of the resized tiles (this is the default setting). "map-resize" - Existing tiles are resized on zoom and placed below the base layer. New tiles for the base layer will cover existing tiles. This setting is recommended when having an overlay duplicated during the transition is undesirable (e.g. street labels or big transparent fills). null - No transition effect.

Using "resize" on non-opaque layers can cause undesired visual effects. Set transitionEffect to null in this case.

public transitionendEvents: Array<string>

Property: transitionendEvents {Array} Event names for transitionend

public units: string

The layer map units. Defaults to null. Possible values are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.

public url: Array<string>

The tileset URL scheme. Defaults to : http://[a|b|c].tile.openstreetmap.org/${z}/${x}/${y}.png (the official OSM tileset) if the second argument to the constructor is null or undefined. To use another tileset you can have something like this: new OpenLayers.Layer.OSM("OpenCycleMap", ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png", "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png", "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"]);

public visibility: boolean

The layer should be displayed in the map. Default is true.

public wrapDateLine: boolean

Wraps the world at the international dateline, so the map can be panned infinitely in longitudinal direction. Only use this on the base layer, and only if the layer's maxExtent equals the world bounds.

public zoomOffset: number

APIProperty: zoomOffset {Number} If your cache has more zoom levels than you want to provide access to with this layer, supply a zoomOffset. This zoom offset is added to the current map zoom level to determine the level for a requested tile. For example, if you supply a zoomOffset of 3, when the map is at the zoom 0, tiles will be requested from level 3 of your cache. Default is 0 (assumes cache level and map zoom are equivalent). Using is an alternative to setting if you only want to expose a subset of the server resolutions.

public addOptions(newOptions: {}, reinitialize: boolean)

APIMethod: addOptions

Parameters: newOptions - {Object} reinitialize - {Boolean} If set to true, and if resolution options of the current baseLayer were changed, the map will be recentered to make sure that it is displayed with a valid resolution, and a changebaselayer event will be triggered.

Parameters

  • newOptions: {}
  • reinitialize: boolean

public addTile(bounds: Bounds, position: number): Tile

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

Parameters bounds - {} position - {}

Returns: {} The added OpenLayers.Tile

Parameters

  • bounds: Bounds
  • position: number

Returns

Tile

public adjustBounds(bounds: Bounds): Bounds

Method: adjustBounds This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right.

Parameters: bounds - {}

Parameters

Returns

Bounds

public calculateInRange(): boolean

APIMethod: calculateInRange

Returns: {Boolean} The layer is displayable at the current map's current resolution. Note that if 'alwaysInRange' is true for the layer, this function will always return true.

Returns

boolean

public calculateResolutions(props: Object): Array<number>

Method: calculateResolutions Calculate resolutions based on the provided properties.

Parameters: props - {Object} Properties

Returns: {Array({Number})} Array of resolutions.

Parameters

  • props: Object

Returns

Array<number>

public clone(obj?: Object): OSM

Create a clone of this layer

Parameters

  • obj?: Object optional

Returns

OSM

public destroy()

APIMethod: destroy Deconstruct the layer and clear the grid.

public display(display: boolean)

APIMethod: display Hide or show the Layer. This is designed to be used internally, and is not generally the way to enable or disable the layer. For that, use the setVisibility function instead..

Parameters: display - {Boolean}

Parameters

  • display: boolean

public getExtent(): Bounds

APIMethod: getExtent

Returns: {} A Bounds object which represents the lon/lat bounds of the current viewPort.

Returns

Bounds

public getFullRequestString(newParams: Object, altUrl: string): string

Method: getFullRequestString Combine url with layer's params and these newParams.

does checking on the serverPath variable, allowing for cases when it is supplied with trailing ? or &, as well as cases where not.

return in formatted string like this: "server?key1=value1&key2=value2&key3=value3"

WARNING: The altUrl parameter is deprecated and will be removed in 3.0.

Parameters: newParams - {Object} altUrl - {String} Use this as the url instead of the layer's url

Returns: {String}

Parameters

  • newParams: Object
  • altUrl: string

Returns

string

public getImageSize(): Size

Returns

Size

public getLonLatFromViewPortPx(viewPortPx: Pixel): LonLat

APIMethod: getLonLatFromViewPortPx

Parameters: viewPortPx - {|Object} An OpenLayers.Pixel or an object with a 'x' and 'y' properties.

Returns: {} An OpenLayers.LonLat which is the passed-in view port , translated into lon/lat by the layer.

Parameters

Returns

LonLat

public getResolution(): number

APIMethod: getResolution

Returns: {Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level.

Returns

number

public getResolutionForZoom(zoom: number): number

APIMethod: getResolutionForZoom

Parameters: zoom - {Float}

Returns: {Float} A suitable resolution for the specified zoom.

Parameters

  • zoom: number

Returns

number

public getTileBounds(viewPortPx: Pixel): Bounds

APIMethod: getTileBounds Returns The tile bounds for a layer given a pixel location.

Parameters: viewPortPx - {} The location in the viewport.

Returns: {} Bounds of the tile at the given pixel location.

Parameters

Returns

Bounds

public getTilesBounds(): Bounds

APIMethod: getTilesBounds Return the bounds of the tile grid.

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

Returns

Bounds

public getViewPortPxFromLonLat(lonlat: LonLat, resolution: number): Pixel

APIMethod: getViewPortPxFromLonLat Returns a pixel location given a map location. This method will return fractional pixel values.

Parameters: lonlat - {|Object} An OpenLayers.LonLat or an object with a 'lon' and 'lat' properties.

Returns: {} An which is the passed-in lonlat translated into view port pixels.

Parameters

  • lonlat: LonLat
  • resolution: number

Returns

Pixel

public getVisibility(): boolean

APIMethod: getVisibility

Returns: {Boolean} The layer should be displayed (if in range).

Returns

boolean

public getZIndex(): number

Method: getZIndex

Returns: {Integer} the z-index of this layer

Returns

number

public getZoomForExtent(extent: Bounds, closest?: boolean): number

APIMethod: getZoomForExtent

Parameters: extent - {} closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) for the passed-in extent. We do this by calculating the ideal resolution for the given extent (based on the map size) and then calling getZoomForResolution(), passing along the 'closest' parameter.

Parameters

  • extent: Bounds
  • closest?: boolean optional

Returns

number

public getZoomForResolution(resolution: number, closest?: boolean): number

APIMethod: getZoomForResolution

Parameters: resolution - {Float} closest - {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it'll be close). Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification.

Parameters

  • resolution: number
  • closest?: boolean optional

Returns

number

public initResolutions()

Method: initResolutions This method's responsibility is to set up the 'resolutions' array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer.

The user has several options that determine how the array is set up.

For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels

public mergeNewParams(newParams: Object): boolean

APIMethod: mergeNewParams

Parameters: newParams - {Object}

Returns: redrawn: {Boolean} whether the layer was actually redrawn.

Parameters

  • newParams: Object

Returns

boolean

public moveByPx(dx: number, dy: number)

Method: moveByPx Move the layer based on pixel vector.

Parameters: dx - {Number} dy - {Number}

Parameters

  • dx: number
  • dy: number

public moveTo(bounds: Bounds, zoomChanged: boolean, dragging: boolean)

Method: moveTo This function is called whenever the map is moved. All the moving of actual 'tiles' is done by the map, but moveTo's role is to accept a bounds and make sure the data that that bounds requires is pre-loaded.

Parameters: bounds - {} zoomChanged - {Boolean} dragging - {Boolean}

Parameters

  • bounds: Bounds
  • zoomChanged: boolean
  • dragging: boolean

public onMapResize()

Method: onMapResize For singleTile layers, this will set a new tile size according to the dimensions of the map pane.

public redraw(force?: boolean): boolean

APIMethod: redraw Redraws the layer. Returns true if the layer was redrawn, false if not.

Parameters: force - {Boolean} Force redraw by adding random parameter.

Returns: {Boolean} The layer was redrawn.

Parameters

  • force?: boolean optional

Returns

boolean

public removeMap(map: Map)

Method: removeMap Called when the layer is removed from the map.

Parameters: map - {} The map.

Parameters

public setIsBaseLayer(isBaseLayer: boolean)

APIMethod: setIsBaseLayer

Parameters: isBaseLayer - {Boolean}

Parameters

  • isBaseLayer: boolean

public setMap(map: Map)

Parameters

public setName(newName: string)

APIMethod: setName Sets the new layer name for this layer. Can trigger a changelayer event on the map.

Parameters: newName - {String} The new name.

Parameters

  • newName: string

public setOpacity(opacity: number)

APIMethod: setOpacity Sets the opacity for the entire layer (all images)

Parameters: opacity - {Float}

Parameters

  • opacity: number

public setTileSize(size: Size)

APIMethod: setTileSize 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 - {}

Parameters

public setUrl(newUrl: string)

APIMethod: setUrl

Parameters: newUrl - {String}

Parameters

  • newUrl: string

public setVisibility(visibility: boolean)

APIMethod: setVisibility Set the visibility flag for the layer and hide/show & redraw accordingly. Fire event unless otherwise specified

Note that visibility is no longer simply whether or not the layer's style.display is set to "block". Now we store a 'visibility' state property on the layer class, this allows us to remember whether or not we desire for a layer to be visible. In the case where the map's resolution is out of the layer's range, this desire may be subverted.

Parameters: visibility - {Boolean} Whether or not to display the layer (if in range)

Parameters

  • visibility: boolean

public setZIndex(zIndex: number)

Method: setZIndex

Parameters: zIndex - {Integer}

Parameters

  • zIndex: number

PointGrid: PointGrid

PointTrack: PointTrack

SphericalMercator: SphericalMercator

TMS: TMS

Text: Text

TileCache: TileCache

UTFGrid: UTFGrid

Vector: Vector

RootContainer: RootContainer

WMS: WMS

constructor(name: string, url: string, params: WMSGetMapParams, options: WMSOptions): WMS

Constructor: OpenLayers.Layer.WMS Create a new WMS layer object

Examples:

The code below creates a simple WMS layer using the image/jpeg format. (code) var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic", "http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"}); (end) Note the 3rd argument (params). Properties added to this object will be added to the WMS GetMap requests used for this layer's tiles. The only mandatory parameter is "layers". Other common WMS params include "transparent", "styles" and "format". Note that the "srs" param will always be ignored. Instead, it will be derived from the baseLayer's or map's projection.

The code below creates a transparent WMS layer with additional options. (code) var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic", "http://wms.jpl.nasa.gov/wms.cgi", { layers: "modis,global_mosaic", transparent: true }, { opacity: 0.5, singleTile: true }); (end) Note that by default, a WMS layer is configured as baseLayer. Setting the "transparent" param to true will apply some magic (see ). The default image format changes from image/jpeg to image/png, and the layer is not configured as baseLayer.

Parameters: name - {String} A name for the layer url - {String} Base url for the WMS (e.g. http://wms.jpl.nasa.gov/wms.cgi) params - {Object} An object with key/value pairs representing the GetMap query string parameters and parameter values. options - {Object} Hashtable of extra options to tag onto the layer. These options include all properties listed above, plus the ones inherited from superclasses.

Parameters

Returns

WMS

public static CLASS_NAME: string

public RESOLUTION_PROPERTIES: Array<string>

The properties that are used for calculating resolutions information.

public alpha: boolean

The layer's images have an alpha channel. Default is false.

public alwaysInRange: boolean

If a layer's display should not be scale-based, this should be set to true. This will cause the layer, as an overlay, to always be 'active', by always returning true from the calculateInRange() function.

If not explicitly specified for a layer, its value will be determined on startup in initResolutions() based on whether or not any scale-specific properties have been set as options on the layer. If no scale-specific options have been set on the layer, we assume that it should always be in range.

public attribution: string

Attribution string, displayed when an has been added to the map.

public backBuffer: HTMLElement

Property: backBuffer {DOMElement} The back buffer.

public backBufferLonLat: { lon: number; lat: number; }

Property: backBufferLonLat {Object} The top-left corner of the current back buffer. Includes lon and lat properties. This object is updated each time a back buffer is created.

public backBufferLonLat.lat: number

public backBufferLonLat.lon: number

public backBufferResolution: number

Property: backBufferResolution {Number} The resolution of the current back buffer. This property is updated each time a back buffer is created.

public backBufferTimerId: number

Property: backBufferTimerId {Number} The id of the back buffer timer. This timer is used to delay the removal of the back buffer, thereby preventing flash effects caused by tile animation.

public buffer: number

APIProperty: buffer {Integer} Used only when in gridded mode, this specifies the number of extra rows and columns 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.

public className: string

APIProperty: className {String} Name of the class added to the layer div. If not set in the options passed to the constructor then className defaults to "olLayerGridSingleTile" for single tile layers (see ), and "olLayerGrid" for non single tile layers.

Note:

The displaying of tiles is not animated by default for single tile layers - OpenLayers' default theme (style.css) includes this: (code) .olLayerGrid .olTileImage { -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } (end) To animate tile displaying for any grid layer the following CSS rule can be used: (code) .olTileImage { -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } (end) In that case, to avoid flash effects, should not be zero.

public displayInLayerSwitcher: boolean

Display the layer's name in the layer switcher. Default is true

public displayOutsideMaxExtent: boolean

Request map tiles that are completely outside of the max extent for this layer. Defaults to false.

public div: HTMLElement

public encodeBBOX: boolean

Should the BBOX commas be encoded? The WMS spec says 'no', but some services want it that way. Default false.

public eventListeners: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public events: Events

APIProperty: events {}

Register a listener for a particular event with the following syntax: (code) layer.events.register(type, obj, listener); (end)

Listeners will be called with a reference to an event object. The properties of this event depends on exactly what happened.

All event objects have at least the following properties: object - {Object} A reference to layer.events.object. element - {DOMElement} A reference to layer.events.element.

Supported map event types: loadstart - Triggered when layer loading starts. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a filter property holding the OpenLayers.Filter used when calling read on the protocol. loadend - Triggered when layer loading ends. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a response property holding an OpenLayers.Protocol.Response object. visibilitychanged - Triggered when the layer's visibility property is changed, e.g. by turning the layer on or off in the layer switcher. Note that the actual visibility of the layer can also change if it gets out of range (see ). If you also want to catch these cases, register for the map's 'changelayer' event instead. move - Triggered when layer moves (triggered with every mousemove during a drag). moveend - Triggered when layer is done moving, object passed as argument has a zoomChanged boolean property which tells that the zoom has changed. added - Triggered after the layer is added to a map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer. removed - Triggered after the layer is removed from the map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer.

public grid: Array<OpenLayers.Tile[]>

Property: grid {Array(Array())} This is an array of rows, each row is an array of tiles.

public gridLayout: { tilelon: number; tilelat: number; startcol: number; startrow: number; }

Property: gridLayout {Object} Object containing properties tilelon, tilelat, startcol, startrow

public gridLayout.startcol: number

public gridLayout.startrow: number

public gridLayout.tilelat: number

public gridLayout.tilelon: number

public gridResolution: number

Property: gridResolution {Number} The resolution of the current grid. Used for backbuffer and client zoom. This property is updated every time the grid is initialized.

public gutter: number

Determines the width (in pixels) of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. This allows artifacts of rendering at tile edges to be ignored. Set a gutter value that is equal to half the size of the widest symbol that needs to be displayed. Defaults to zero. Non-tiled layers always have zero gutter.

public id: string

public imageSize: Size

For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension.

public inRange: boolean

The current map resolution is within the layer's min/max range. This is set in whenever the zoom changes.

public isBaseLayer: boolean

Default is true for WMS layer

public loading: boolean

Property: loading {Boolean} Indicates if tiles are being loaded.

public map: Map

This variable is set when the layer is added to the map, via the accessor function setMap()

public maxExtent: Bounds

The maximum extent for the layer. Defaults to null.

public maxResolution: number

Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. Specify a different value in the layer options if you are not using the default and displaying the whole world.

public maxScale: number

public metadata: Object

This object can be used to store additional information on a layer object.

public minExtent: Bounds

The minimum extent for the layer. Defaults to null.

public minResolution: number

public minScale: number

public name: string

public noMagic: boolean

If true, the image format will not be automagicaly switched from image/jpeg to image/png or image/gif when using TRANSPARENT=TRUE. Also isBaseLayer will not changed by the constructor. Default false.

public numLoadingTiles: number

APIProperty: numLoadingTiles {Integer} How many tiles are still loading?

public numZoomLevels: number

public opacity: number

The layer's opacity. Float number between 0.0 and 1.0.

public options: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public params: Object

Property: params {Object} Hashtable of key/value parameters

public projection: Projection

Specifies the projection of the layer. Can be set in the layer options. If not specified in the layer options, it is set to the default projection specified in the map, when the layer is added to the map. Projection along with default maxExtent and resolutions are set automatically with commercial baselayers in EPSG:3857, such as Google, Bing and OpenStreetMap, and do not need to be specified. Otherwise, if specifying projection, also set maxExtent, maxResolution or resolutions as appropriate. When using vector layers with strategies, layer projection should be set to the projection of the source data if that is different from the map default.

public ratio: number

APIProperty: 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. Default value is 1.5.

public removeBackBufferDelay: number

APIProperty: removeBackBufferDelay {Number} Delay for removing the backbuffer when all tiles have finished loading. Can be set to 0 when no css opacity transitions for the olTileImage class are used. Default is 0 for layers, 2500 for tiled layers. See for more information on tile animation.

public reproject: boolean

APIProperty: reproject Deprecated. See http://docs.openlayers.org/library/spherical_mercator.html for information on the replacement for this functionality. {Boolean} Whether layer should reproject itself based on base layer locations. This allows reprojection onto commercial layers. Default is false: Most layers can't reproject, but layers which can create non-square geographic pixels can, like WMS.

public resolutions: Array<any>

A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).

public rowSign: number

Property: rowSign {Number} 1 for grids starting at the top, -1 for grids starting at the bottom. This is used for several grid index and offset calculations.

public scales: Array<any>

An array of map scales in descending order. The values in the array correspond to the map scale denominator. Note that these values only make sense if the display (monitor) resolution of the client is correctly guessed by whomever is configuring the application. In addition, the units property must also be set. Use instead wherever possible.

public serverResolutions: Array<number>

Property: serverResolutions {Array(Number}} This property is documented in subclasses as an API property.

public singleTile: boolean

APIProperty: 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.

public tileClass: Tile

APIProperty: tileClass {} The tile class to use for this layer. Defaults is OpenLayers.Tile.Image.

public tileOptions: Object

APIProperty: tileOptions {Object} optional configuration options for instances created by this Layer, if supported by the tile class.

public tileOrigin: LonLat

APIProperty: tileOrigin {} 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

. Default is null.

public tileOriginCorner: string

Property: tileOriginCorner {String} If the property is not provided, the tile origin will be derived from the layer's . The corner of the

used is determined by this property. Acceptable values are "tl" (top left), "tr" (top right), "bl" (bottom left), and "br" (bottom right). Default is "bl".

public tileSize: Size

APIProperty: tileSize {}

public transitionEffect: string

APIProperty: transitionEffect {String} The transition effect to use when the map is zoomed. Two posible values:

"resize" - Existing tiles are resized on zoom to provide a visual effect of the zoom having taken place immediately. As the new tiles become available, they are drawn on top of the resized tiles (this is the default setting). "map-resize" - Existing tiles are resized on zoom and placed below the base layer. New tiles for the base layer will cover existing tiles. This setting is recommended when having an overlay duplicated during the transition is undesirable (e.g. street labels or big transparent fills). null - No transition effect.

Using "resize" on non-opaque layers can cause undesired visual effects. Set transitionEffect to null in this case.

public transitionendEvents: Array<string>

Property: transitionendEvents {Array} Event names for transitionend

public units: string

The layer map units. Defaults to null. Possible values are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.

public url: Array<string>

Property: url {Array(String) or String} This is either an array of url strings or a single url string.

public visibility: boolean

The layer should be displayed in the map. Default is true.

public wrapDateLine: boolean

Wraps the world at the international dateline, so the map can be panned infinitely in longitudinal direction. Only use this on the base layer, and only if the layer's maxExtent equals the world bounds.

public yx: Object

Keys in this object are EPSG codes for which the axis order is to be reversed (yx instead of xy, LatLon instead of LonLat), with true as value. This is only relevant for WMS versions >= 1.3.0, and only if yx is not set in for the used projection.

public addOptions(newOptions: {}, reinitialize: boolean)

APIMethod: addOptions

Parameters: newOptions - {Object} reinitialize - {Boolean} If set to true, and if resolution options of the current baseLayer were changed, the map will be recentered to make sure that it is displayed with a valid resolution, and a changebaselayer event will be triggered.

Parameters

  • newOptions: {}
  • reinitialize: boolean

public addTile(bounds: Bounds, position: number): Tile

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

Parameters bounds - {} position - {}

Returns: {} The added OpenLayers.Tile

Parameters

  • bounds: Bounds
  • position: number

Returns

Tile

public adjustBounds(bounds: Bounds): Bounds

Method: adjustBounds This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right.

Parameters: bounds - {}

Parameters

Returns

Bounds

public calculateInRange(): boolean

APIMethod: calculateInRange

Returns: {Boolean} The layer is displayable at the current map's current resolution. Note that if 'alwaysInRange' is true for the layer, this function will always return true.

Returns

boolean

public calculateResolutions(props: Object): Array<number>

Method: calculateResolutions Calculate resolutions based on the provided properties.

Parameters: props - {Object} Properties

Returns: {Array({Number})} Array of resolutions.

Parameters

  • props: Object

Returns

Array<number>

public clone(): WMS

Create a clone of this layer

Returns

WMS

public destroy()

APIMethod: destroy Deconstruct the layer and clear the grid.

public display(display: boolean)

APIMethod: display Hide or show the Layer. This is designed to be used internally, and is not generally the way to enable or disable the layer. For that, use the setVisibility function instead..

Parameters: display - {Boolean}

Parameters

  • display: boolean

public getExtent(): Bounds

APIMethod: getExtent

Returns: {} A Bounds object which represents the lon/lat bounds of the current viewPort.

Returns

Bounds

public getFullRequestString(newParams: Object, altUrl: string): string

Combine the layer's url with its params and these newParams.

Add the SRS parameter from projection -- this is probably more eloquently done via a setProjection() method, but this works for now and always.

Parameters

  • newParams: Object
  • altUrl: string

Returns

string

public getImageSize(): Size

Returns

Size

public getLonLatFromViewPortPx(viewPortPx: Pixel): LonLat

APIMethod: getLonLatFromViewPortPx

Parameters: viewPortPx - {|Object} An OpenLayers.Pixel or an object with a 'x' and 'y' properties.

Returns: {} An OpenLayers.LonLat which is the passed-in view port , translated into lon/lat by the layer.

Parameters

Returns

LonLat

public getResolution(): number

APIMethod: getResolution

Returns: {Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level.

Returns

number

public getResolutionForZoom(zoom: number): number

APIMethod: getResolutionForZoom

Parameters: zoom - {Float}

Returns: {Float} A suitable resolution for the specified zoom.

Parameters

  • zoom: number

Returns

number

public getTileBounds(viewPortPx: Pixel): Bounds

APIMethod: getTileBounds Returns The tile bounds for a layer given a pixel location.

Parameters: viewPortPx - {} The location in the viewport.

Returns: {} Bounds of the tile at the given pixel location.

Parameters

Returns

Bounds

public getTilesBounds(): Bounds

APIMethod: getTilesBounds Return the bounds of the tile grid.

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

Returns

Bounds

public getURL(bounds: Bounds): string

Return a GetMap query string for this layer

Parameters

Returns

string

public getViewPortPxFromLonLat(lonlat: LonLat, resolution: number): Pixel

APIMethod: getViewPortPxFromLonLat Returns a pixel location given a map location. This method will return fractional pixel values.

Parameters: lonlat - {|Object} An OpenLayers.LonLat or an object with a 'lon' and 'lat' properties.

Returns: {} An which is the passed-in lonlat translated into view port pixels.

Parameters

  • lonlat: LonLat
  • resolution: number

Returns

Pixel

public getVisibility(): boolean

APIMethod: getVisibility

Returns: {Boolean} The layer should be displayed (if in range).

Returns

boolean

public getZIndex(): number

Method: getZIndex

Returns: {Integer} the z-index of this layer

Returns

number

public getZoomForExtent(extent: Bounds, closest?: boolean): number

APIMethod: getZoomForExtent

Parameters: extent - {} closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) for the passed-in extent. We do this by calculating the ideal resolution for the given extent (based on the map size) and then calling getZoomForResolution(), passing along the 'closest' parameter.

Parameters

  • extent: Bounds
  • closest?: boolean optional

Returns

number

public getZoomForResolution(resolution: number, closest?: boolean): number

APIMethod: getZoomForResolution

Parameters: resolution - {Float} closest - {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it'll be close). Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification.

Parameters

  • resolution: number
  • closest?: boolean optional

Returns

number

public initResolutions()

Method: initResolutions This method's responsibility is to set up the 'resolutions' array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer.

The user has several options that determine how the array is set up.

For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels

public mergeNewParams(newParams: Object): boolean

Catch changeParams and uppercase the new params to be merged in before calling changeParams on the super class. Once params have been changed, the tiles will be reloaded with the new parameters.

Parameters

  • newParams: Object

Returns

boolean

public moveByPx(dx: number, dy: number)

Method: moveByPx Move the layer based on pixel vector.

Parameters: dx - {Number} dy - {Number}

Parameters

  • dx: number
  • dy: number

public moveTo(bounds: Bounds, zoomChanged: boolean, dragging: boolean)

Method: moveTo This function is called whenever the map is moved. All the moving of actual 'tiles' is done by the map, but moveTo's role is to accept a bounds and make sure the data that that bounds requires is pre-loaded.

Parameters: bounds - {} zoomChanged - {Boolean} dragging - {Boolean}

Parameters

  • bounds: Bounds
  • zoomChanged: boolean
  • dragging: boolean

public onMapResize()

Method: onMapResize For singleTile layers, this will set a new tile size according to the dimensions of the map pane.

public redraw(force?: boolean): boolean

APIMethod: redraw Redraws the layer. Returns true if the layer was redrawn, false if not.

Parameters: force - {Boolean} Force redraw by adding random parameter.

Returns: {Boolean} The layer was redrawn.

Parameters

  • force?: boolean optional

Returns

boolean

public removeMap(map: Map)

Method: removeMap Called when the layer is removed from the map.

Parameters: map - {} The map.

Parameters

public reverseAxisOrder(): boolean

Returns true if the axis order is reversed for the WMS version and projection of the layer.

Returns

boolean

public setIsBaseLayer(isBaseLayer: boolean)

APIMethod: setIsBaseLayer

Parameters: isBaseLayer - {Boolean}

Parameters

  • isBaseLayer: boolean

public setMap(map: Map)

Method: setMap

Parameters: map - {} The map.

Parameters

public setName(newName: string)

APIMethod: setName Sets the new layer name for this layer. Can trigger a changelayer event on the map.

Parameters: newName - {String} The new name.

Parameters

  • newName: string

public setOpacity(opacity: number)

APIMethod: setOpacity Sets the opacity for the entire layer (all images)

Parameters: opacity - {Float}

Parameters

  • opacity: number

public setTileSize(size: Size)

APIMethod: setTileSize 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 - {}

Parameters

public setUrl(newUrl: string)

APIMethod: setUrl

Parameters: newUrl - {String}

Parameters

  • newUrl: string

public setVisibility(visibility: boolean)

APIMethod: setVisibility Set the visibility flag for the layer and hide/show & redraw accordingly. Fire event unless otherwise specified

Note that visibility is no longer simply whether or not the layer's style.display is set to "block". Now we store a 'visibility' state property on the layer class, this allows us to remember whether or not we desire for a layer to be visible. In the case where the map's resolution is out of the layer's range, this desire may be subverted.

Parameters: visibility - {Boolean} Whether or not to display the layer (if in range)

Parameters

  • visibility: boolean

public setZIndex(zIndex: number)

Method: setZIndex

Parameters: zIndex - {Integer}

Parameters

  • zIndex: number

WMTS: WMTS

WorldWind: WorldWind

XYZ: XYZ

constructor(name: number, url: string, options: {}): XYZ

Constructor: OpenLayers.Layer.XYZ

Parameters: name - {String} url - {String} options - {Object} Hashtable of extra options to tag onto the layer

Parameters

  • name: number
  • url: string
  • options: {}

Returns

XYZ

public RESOLUTION_PROPERTIES: Array<string>

The properties that are used for calculating resolutions information.

public alpha: boolean

The layer's images have an alpha channel. Default is false.

public alwaysInRange: boolean

If a layer's display should not be scale-based, this should be set to true. This will cause the layer, as an overlay, to always be 'active', by always returning true from the calculateInRange() function.

If not explicitly specified for a layer, its value will be determined on startup in initResolutions() based on whether or not any scale-specific properties have been set as options on the layer. If no scale-specific options have been set on the layer, we assume that it should always be in range.

public attribution: string

Attribution string, displayed when an has been added to the map.

public backBuffer: HTMLElement

Property: backBuffer {DOMElement} The back buffer.

public backBufferLonLat: { lon: number; lat: number; }

Property: backBufferLonLat {Object} The top-left corner of the current back buffer. Includes lon and lat properties. This object is updated each time a back buffer is created.

public backBufferLonLat.lat: number

public backBufferLonLat.lon: number

public backBufferResolution: number

Property: backBufferResolution {Number} The resolution of the current back buffer. This property is updated each time a back buffer is created.

public backBufferTimerId: number

Property: backBufferTimerId {Number} The id of the back buffer timer. This timer is used to delay the removal of the back buffer, thereby preventing flash effects caused by tile animation.

public buffer: number

APIProperty: buffer {Integer} Used only when in gridded mode, this specifies the number of extra rows and columns 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.

public className: string

APIProperty: className {String} Name of the class added to the layer div. If not set in the options passed to the constructor then className defaults to "olLayerGridSingleTile" for single tile layers (see ), and "olLayerGrid" for non single tile layers.

Note:

The displaying of tiles is not animated by default for single tile layers - OpenLayers' default theme (style.css) includes this: (code) .olLayerGrid .olTileImage { -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } (end) To animate tile displaying for any grid layer the following CSS rule can be used: (code) .olTileImage { -webkit-transition: opacity 0.2s linear; -moz-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear; transition: opacity 0.2s linear; } (end) In that case, to avoid flash effects, should not be zero.

public displayInLayerSwitcher: boolean

Display the layer's name in the layer switcher. Default is true

public displayOutsideMaxExtent: boolean

Request map tiles that are completely outside of the max extent for this layer. Defaults to false.

public div: HTMLElement

public eventListeners: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public events: Events

APIProperty: events {}

Register a listener for a particular event with the following syntax: (code) layer.events.register(type, obj, listener); (end)

Listeners will be called with a reference to an event object. The properties of this event depends on exactly what happened.

All event objects have at least the following properties: object - {Object} A reference to layer.events.object. element - {DOMElement} A reference to layer.events.element.

Supported map event types: loadstart - Triggered when layer loading starts. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a filter property holding the OpenLayers.Filter used when calling read on the protocol. loadend - Triggered when layer loading ends. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a response property holding an OpenLayers.Protocol.Response object. visibilitychanged - Triggered when the layer's visibility property is changed, e.g. by turning the layer on or off in the layer switcher. Note that the actual visibility of the layer can also change if it gets out of range (see ). If you also want to catch these cases, register for the map's 'changelayer' event instead. move - Triggered when layer moves (triggered with every mousemove during a drag). moveend - Triggered when layer is done moving, object passed as argument has a zoomChanged boolean property which tells that the zoom has changed. added - Triggered after the layer is added to a map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer. removed - Triggered after the layer is removed from the map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer.

public grid: Array<OpenLayers.Tile[]>

Property: grid {Array(Array())} This is an array of rows, each row is an array of tiles.

public gridLayout: { tilelon: number; tilelat: number; startcol: number; startrow: number; }

Property: gridLayout {Object} Object containing properties tilelon, tilelat, startcol, startrow

public gridLayout.startcol: number

public gridLayout.startrow: number

public gridLayout.tilelat: number

public gridLayout.tilelon: number

public gridResolution: number

Property: gridResolution {Number} The resolution of the current grid. Used for backbuffer and client zoom. This property is updated every time the grid is initialized.

public gutter: number

Determines the width (in pixels) of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. This allows artifacts of rendering at tile edges to be ignored. Set a gutter value that is equal to half the size of the widest symbol that needs to be displayed. Defaults to zero. Non-tiled layers always have zero gutter.

public id: string

public imageSize: Size

For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension.

public inRange: boolean

The current map resolution is within the layer's min/max range. This is set in whenever the zoom changes.

public isBaseLayer: boolean

APIProperty: isBaseLayer Default is true, as this is designed to be a base tile source.

public loading: boolean

Property: loading {Boolean} Indicates if tiles are being loaded.

public map: Map

This variable is set when the layer is added to the map, via the accessor function setMap()

public maxExtent: Bounds

The maximum extent for the layer. Defaults to null.

public maxResolution: number

Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. Specify a different value in the layer options if you are not using the default and displaying the whole world.

public maxScale: number

public metadata: Object

This object can be used to store additional information on a layer object.

public minExtent: Bounds

The minimum extent for the layer. Defaults to null.

public minResolution: number

public minScale: number

public name: string

public numLoadingTiles: number

APIProperty: numLoadingTiles {Integer} How many tiles are still loading?

public numZoomLevels: number

public opacity: number

The layer's opacity. Float number between 0.0 and 1.0.

public options: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public params: Object

Property: params {Object} Hashtable of key/value parameters

public projection: Projection

Specifies the projection of the layer. Can be set in the layer options. If not specified in the layer options, it is set to the default projection specified in the map, when the layer is added to the map. Projection along with default maxExtent and resolutions are set automatically with commercial baselayers in EPSG:3857, such as Google, Bing and OpenStreetMap, and do not need to be specified. Otherwise, if specifying projection, also set maxExtent, maxResolution or resolutions as appropriate. When using vector layers with strategies, layer projection should be set to the projection of the source data if that is different from the map default.

public ratio: number

APIProperty: 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. Default value is 1.5.

public removeBackBufferDelay: number

APIProperty: removeBackBufferDelay {Number} Delay for removing the backbuffer when all tiles have finished loading. Can be set to 0 when no css opacity transitions for the olTileImage class are used. Default is 0 for layers, 2500 for tiled layers. See for more information on tile animation.

public reproject: boolean

APIProperty: reproject Deprecated. See http://docs.openlayers.org/library/spherical_mercator.html for information on the replacement for this functionality. {Boolean} Whether layer should reproject itself based on base layer locations. This allows reprojection onto commercial layers. Default is false: Most layers can't reproject, but layers which can create non-square geographic pixels can, like WMS.

public resolutions: Array<any>

A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).

public rowSign: number

Property: rowSign {Number} 1 for grids starting at the top, -1 for grids starting at the bottom. This is used for several grid index and offset calculations.

public scales: Array<any>

An array of map scales in descending order. The values in the array correspond to the map scale denominator. Note that these values only make sense if the display (monitor) resolution of the client is correctly guessed by whomever is configuring the application. In addition, the units property must also be set. Use instead wherever possible.

public serverResolutions: Array<number>

APIProperty: serverResolutions {Array} A list of all resolutions available on the server. Only set this property if the map resolutions differ from the server. This property serves two purposes. (a) can include resolutions that the server supports and that you don't want to provide with this layer; you can also look at , which is an alternative to for that specific purpose. (b) The map can work with resolutions that aren't supported by the server, i.e. that aren't in . When the map is displayed in such a resolution data for the closest server-supported resolution is loaded and the layer div is stretched as necessary.

public singleTile: boolean

APIProperty: 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.

public sphericalMercator: boolean

APIProperty: sphericalMercator Whether the tile extents should be set to the defaults for spherical mercator. Useful for things like OpenStreetMap. Default is false, except for the OSM subclass.

public tileClass: Tile

APIProperty: tileClass {} The tile class to use for this layer. Defaults is OpenLayers.Tile.Image.

public tileOptions: Object

APIProperty: tileOptions {Object} optional configuration options for instances created by this Layer, if supported by the tile class.

public tileOrigin: LonLat

APIProperty: tileOrigin {} 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

. Default is null.

public tileOriginCorner: string

Property: tileOriginCorner {String} If the property is not provided, the tile origin will be derived from the layer's . The corner of the

used is determined by this property. Acceptable values are "tl" (top left), "tr" (top right), "bl" (bottom left), and "br" (bottom right). Default is "bl".

public tileSize: Size

APIProperty: tileSize {}

public transitionEffect: string

APIProperty: transitionEffect {String} The transition effect to use when the map is zoomed. Two posible values:

"resize" - Existing tiles are resized on zoom to provide a visual effect of the zoom having taken place immediately. As the new tiles become available, they are drawn on top of the resized tiles (this is the default setting). "map-resize" - Existing tiles are resized on zoom and placed below the base layer. New tiles for the base layer will cover existing tiles. This setting is recommended when having an overlay duplicated during the transition is undesirable (e.g. street labels or big transparent fills). null - No transition effect.

Using "resize" on non-opaque layers can cause undesired visual effects. Set transitionEffect to null in this case.

public transitionendEvents: Array<string>

Property: transitionendEvents {Array} Event names for transitionend

public units: string

The layer map units. Defaults to null. Possible values are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.

public url: Array<string>

Property: url {Array(String) or String} This is either an array of url strings or a single url string.

public visibility: boolean

The layer should be displayed in the map. Default is true.

public wrapDateLine: boolean

Wraps the world at the international dateline, so the map can be panned infinitely in longitudinal direction. Only use this on the base layer, and only if the layer's maxExtent equals the world bounds.

public zoomOffset: number

APIProperty: zoomOffset {Number} If your cache has more zoom levels than you want to provide access to with this layer, supply a zoomOffset. This zoom offset is added to the current map zoom level to determine the level for a requested tile. For example, if you supply a zoomOffset of 3, when the map is at the zoom 0, tiles will be requested from level 3 of your cache. Default is 0 (assumes cache level and map zoom are equivalent). Using is an alternative to setting if you only want to expose a subset of the server resolutions.

public addOptions(newOptions: {}, reinitialize: boolean)

APIMethod: addOptions

Parameters: newOptions - {Object} reinitialize - {Boolean} If set to true, and if resolution options of the current baseLayer were changed, the map will be recentered to make sure that it is displayed with a valid resolution, and a changebaselayer event will be triggered.

Parameters

  • newOptions: {}
  • reinitialize: boolean

public addTile(bounds: Bounds, position: number): Tile

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

Parameters bounds - {} position - {}

Returns: {} The added OpenLayers.Tile

Parameters

  • bounds: Bounds
  • position: number

Returns

Tile

public adjustBounds(bounds: Bounds): Bounds

Method: adjustBounds This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right.

Parameters: bounds - {}

Parameters

Returns

Bounds

public calculateInRange(): boolean

APIMethod: calculateInRange

Returns: {Boolean} The layer is displayable at the current map's current resolution. Note that if 'alwaysInRange' is true for the layer, this function will always return true.

Returns

boolean

public calculateResolutions(props: Object): Array<number>

Method: calculateResolutions Calculate resolutions based on the provided properties.

Parameters: props - {Object} Properties

Returns: {Array({Number})} Array of resolutions.

Parameters

  • props: Object

Returns

Array<number>

public clone(obj?: Object): XYZ

APIMethod: clone Create a clone of this layer

Parameters: obj - {Object} Is this ever used?

Returns: {} An exact clone of this OpenLayers.Layer.XYZ

Parameters

  • obj?: Object optional

Returns

XYZ

public destroy()

APIMethod: destroy Deconstruct the layer and clear the grid.

public display(display: boolean)

APIMethod: display Hide or show the Layer. This is designed to be used internally, and is not generally the way to enable or disable the layer. For that, use the setVisibility function instead..

Parameters: display - {Boolean}

Parameters

  • display: boolean

public getExtent(): Bounds

APIMethod: getExtent

Returns: {} A Bounds object which represents the lon/lat bounds of the current viewPort.

Returns

Bounds

public getFullRequestString(newParams: Object, altUrl: string): string

Method: getFullRequestString Combine url with layer's params and these newParams.

does checking on the serverPath variable, allowing for cases when it is supplied with trailing ? or &, as well as cases where not.

return in formatted string like this: "server?key1=value1&key2=value2&key3=value3"

WARNING: The altUrl parameter is deprecated and will be removed in 3.0.

Parameters: newParams - {Object} altUrl - {String} Use this as the url instead of the layer's url

Returns: {String}

Parameters

  • newParams: Object
  • altUrl: string

Returns

string

public getImageSize(): Size

Returns

Size

public getLonLatFromViewPortPx(viewPortPx: Pixel): LonLat

APIMethod: getLonLatFromViewPortPx

Parameters: viewPortPx - {|Object} An OpenLayers.Pixel or an object with a 'x' and 'y' properties.

Returns: {} An OpenLayers.LonLat which is the passed-in view port , translated into lon/lat by the layer.

Parameters

Returns

LonLat

public getResolution(): number

APIMethod: getResolution

Returns: {Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level.

Returns

number

public getResolutionForZoom(zoom: number): number

APIMethod: getResolutionForZoom

Parameters: zoom - {Float}

Returns: {Float} A suitable resolution for the specified zoom.

Parameters

  • zoom: number

Returns

number

public getTileBounds(viewPortPx: Pixel): Bounds

APIMethod: getTileBounds Returns The tile bounds for a layer given a pixel location.

Parameters: viewPortPx - {} The location in the viewport.

Returns: {} Bounds of the tile at the given pixel location.

Parameters

Returns

Bounds

public getTilesBounds(): Bounds

APIMethod: getTilesBounds Return the bounds of the tile grid.

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

Returns

Bounds

private getURL(bounds: Bounds): string

Method: getURL

Parameters: bounds - {}

Returns: {String} A string with the layer's url and parameters and also the passed-in bounds and appropriate tile size specified as parameters

Parameters

Returns

string

public getViewPortPxFromLonLat(lonlat: LonLat, resolution: number): Pixel

APIMethod: getViewPortPxFromLonLat Returns a pixel location given a map location. This method will return fractional pixel values.

Parameters: lonlat - {|Object} An OpenLayers.LonLat or an object with a 'lon' and 'lat' properties.

Returns: {} An which is the passed-in lonlat translated into view port pixels.

Parameters

  • lonlat: LonLat
  • resolution: number

Returns

Pixel

public getVisibility(): boolean

APIMethod: getVisibility

Returns: {Boolean} The layer should be displayed (if in range).

Returns

boolean

private getXYZ(bounds: Bounds): { x: number; y: number; z: number; }

Method: getXYZ Calculates x, y and z for the given bounds.

Parameters: bounds - {}

Returns: {Object} - an object with x, y and z properties.

Parameters

Returns

{ x: number; y: number; z: number; }

public getZIndex(): number

Method: getZIndex

Returns: {Integer} the z-index of this layer

Returns

number

public getZoomForExtent(extent: Bounds, closest?: boolean): number

APIMethod: getZoomForExtent

Parameters: extent - {} closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) for the passed-in extent. We do this by calculating the ideal resolution for the given extent (based on the map size) and then calling getZoomForResolution(), passing along the 'closest' parameter.

Parameters

  • extent: Bounds
  • closest?: boolean optional

Returns

number

public getZoomForResolution(resolution: number, closest?: boolean): number

APIMethod: getZoomForResolution

Parameters: resolution - {Float} closest - {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it'll be close). Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification.

Parameters

  • resolution: number
  • closest?: boolean optional

Returns

number

public initResolutions()

Method: initResolutions This method's responsibility is to set up the 'resolutions' array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer.

The user has several options that determine how the array is set up.

For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels

public mergeNewParams(newParams: Object): boolean

APIMethod: mergeNewParams

Parameters: newParams - {Object}

Returns: redrawn: {Boolean} whether the layer was actually redrawn.

Parameters

  • newParams: Object

Returns

boolean

public moveByPx(dx: number, dy: number)

Method: moveByPx Move the layer based on pixel vector.

Parameters: dx - {Number} dy - {Number}

Parameters

  • dx: number
  • dy: number

public moveTo(bounds: Bounds, zoomChanged: boolean, dragging: boolean)

Method: moveTo This function is called whenever the map is moved. All the moving of actual 'tiles' is done by the map, but moveTo's role is to accept a bounds and make sure the data that that bounds requires is pre-loaded.

Parameters: bounds - {} zoomChanged - {Boolean} dragging - {Boolean}

Parameters

  • bounds: Bounds
  • zoomChanged: boolean
  • dragging: boolean

public onMapResize()

Method: onMapResize For singleTile layers, this will set a new tile size according to the dimensions of the map pane.

public redraw(force?: boolean): boolean

APIMethod: redraw Redraws the layer. Returns true if the layer was redrawn, false if not.

Parameters: force - {Boolean} Force redraw by adding random parameter.

Returns: {Boolean} The layer was redrawn.

Parameters

  • force?: boolean optional

Returns

boolean

public removeMap(map: Map)

Method: removeMap Called when the layer is removed from the map.

Parameters: map - {} The map.

Parameters

public setIsBaseLayer(isBaseLayer: boolean)

APIMethod: setIsBaseLayer

Parameters: isBaseLayer - {Boolean}

Parameters

  • isBaseLayer: boolean

public setMap(map: Map)

Parameters

public setName(newName: string)

APIMethod: setName Sets the new layer name for this layer. Can trigger a changelayer event on the map.

Parameters: newName - {String} The new name.

Parameters

  • newName: string

public setOpacity(opacity: number)

APIMethod: setOpacity Sets the opacity for the entire layer (all images)

Parameters: opacity - {Float}

Parameters

  • opacity: number

public setTileSize(size: Size)

APIMethod: setTileSize 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 - {}

Parameters

public setUrl(newUrl: string)

APIMethod: setUrl

Parameters: newUrl - {String}

Parameters

  • newUrl: string

public setVisibility(visibility: boolean)

APIMethod: setVisibility Set the visibility flag for the layer and hide/show & redraw accordingly. Fire event unless otherwise specified

Note that visibility is no longer simply whether or not the layer's style.display is set to "block". Now we store a 'visibility' state property on the layer class, this allows us to remember whether or not we desire for a layer to be visible. In the case where the map's resolution is out of the layer's range, this desire may be subverted.

Parameters: visibility - {Boolean} Whether or not to display the layer (if in range)

Parameters

  • visibility: boolean

public setZIndex(zIndex: number)

Method: setZIndex

Parameters: zIndex - {Integer}

Parameters

  • zIndex: number

Zoomify: Zoomify

Constructor methods

constructor(name: string, options: LayerOptions): Layer

Constructor: OpenLayers.Layer

Parameters: name - {String} The layer name options - {Object} Hashtable of extra options to tag onto the layer

Parameters

Returns

Layer

Properties

public static CLASS_NAME: string

public RESOLUTION_PROPERTIES: Array<string>

The properties that are used for calculating resolutions information.

public alpha: boolean

The layer's images have an alpha channel. Default is false.

public alwaysInRange: boolean

If a layer's display should not be scale-based, this should be set to true. This will cause the layer, as an overlay, to always be 'active', by always returning true from the calculateInRange() function.

If not explicitly specified for a layer, its value will be determined on startup in initResolutions() based on whether or not any scale-specific properties have been set as options on the layer. If no scale-specific options have been set on the layer, we assume that it should always be in range.

public attribution: string

Attribution string, displayed when an has been added to the map.

public displayInLayerSwitcher: boolean

Display the layer's name in the layer switcher. Default is true

public displayOutsideMaxExtent: boolean

Request map tiles that are completely outside of the max extent for this layer. Defaults to false.

public div: HTMLElement

public eventListeners: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public events: Events

APIProperty: events {}

Register a listener for a particular event with the following syntax: (code) layer.events.register(type, obj, listener); (end)

Listeners will be called with a reference to an event object. The properties of this event depends on exactly what happened.

All event objects have at least the following properties: object - {Object} A reference to layer.events.object. element - {DOMElement} A reference to layer.events.element.

Supported map event types: loadstart - Triggered when layer loading starts. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a filter property holding the OpenLayers.Filter used when calling read on the protocol. loadend - Triggered when layer loading ends. When using a Vector layer with a Fixed or BBOX strategy, the event object includes a response property holding an OpenLayers.Protocol.Response object. visibilitychanged - Triggered when the layer's visibility property is changed, e.g. by turning the layer on or off in the layer switcher. Note that the actual visibility of the layer can also change if it gets out of range (see ). If you also want to catch these cases, register for the map's 'changelayer' event instead. move - Triggered when layer moves (triggered with every mousemove during a drag). moveend - Triggered when layer is done moving, object passed as argument has a zoomChanged boolean property which tells that the zoom has changed. added - Triggered after the layer is added to a map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer. removed - Triggered after the layer is removed from the map. Listeners will receive an object with a map property referencing the map and a layer property referencing the layer.

public gutter: number

Determines the width (in pixels) of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. This allows artifacts of rendering at tile edges to be ignored. Set a gutter value that is equal to half the size of the widest symbol that needs to be displayed. Defaults to zero. Non-tiled layers always have zero gutter.

public id: string

public imageSize: Size

For layers with a gutter, the image is larger than the tile by twice the gutter in each dimension.

public inRange: boolean

The current map resolution is within the layer's min/max range. This is set in whenever the zoom changes.

public isBaseLayer: boolean

Whether or not the layer is a base layer. This should be set individually by all subclasses. Default is false

public map: Map

This variable is set when the layer is added to the map, via the accessor function setMap()

public maxExtent: Bounds

The maximum extent for the layer. Defaults to null.

public maxResolution: number

Default max is 360 deg / 256 px, which corresponds to zoom level 0 on gmaps. Specify a different value in the layer options if you are not using the default and displaying the whole world.

public maxScale: number

public metadata: Object

This object can be used to store additional information on a layer object.

public minExtent: Bounds

The minimum extent for the layer. Defaults to null.

public minResolution: number

public minScale: number

public name: string

public numZoomLevels: number

public opacity: number

The layer's opacity. Float number between 0.0 and 1.0.

public options: Object

An optional object whose properties will be set on the layer. Any of the layer properties can be set as a property of the options object and sent to the constructor when the layer is created.

public projection: Projection

Specifies the projection of the layer. Can be set in the layer options. If not specified in the layer options, it is set to the default projection specified in the map, when the layer is added to the map. Projection along with default maxExtent and resolutions are set automatically with commercial baselayers in EPSG:3857, such as Google, Bing and OpenStreetMap, and do not need to be specified. Otherwise, if specifying projection, also set maxExtent, maxResolution or resolutions as appropriate. When using vector layers with strategies, layer projection should be set to the projection of the source data if that is different from the map default.

public resolutions: Array<any>

A list of map resolutions (map units per pixel) in descending order. If this is not set in the layer constructor, it will be set based on other resolution related properties (maxExtent, maxResolution, maxScale, etc.).

public scales: Array<any>

An array of map scales in descending order. The values in the array correspond to the map scale denominator. Note that these values only make sense if the display (monitor) resolution of the client is correctly guessed by whomever is configuring the application. In addition, the units property must also be set. Use instead wherever possible.

public units: string

The layer map units. Defaults to null. Possible values are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.

public visibility: boolean

The layer should be displayed in the map. Default is true.

public wrapDateLine: boolean

Wraps the world at the international dateline, so the map can be panned infinitely in longitudinal direction. Only use this on the base layer, and only if the layer's maxExtent equals the world bounds.

Methods

public addOptions(newOptions: LayerOptions, reinitialize: boolean)

APIMethod: addOptions

Parameters: newOptions - {Object} reinitialize - {Boolean} If set to true, and if resolution options of the current baseLayer were changed, the map will be recentered to make sure that it is displayed with a valid resolution, and a changebaselayer event will be triggered.

Parameters

public adjustBounds(bounds: Bounds): Bounds

Method: adjustBounds This function will take a bounds, and if wrapDateLine option is set on the layer, it will return a bounds which is wrapped around the world. We do not wrap for bounds which cross the maxExtent.left/right, only bounds which are entirely to the left or entirely to the right.

Parameters: bounds - {}

Parameters

Returns

Bounds

private afterAdd()

Method: afterAdd Called at the end of the map.addLayer sequence. At this point, the map will have a base layer. To be overridden by subclasses.

public calculateInRange(): boolean

APIMethod: calculateInRange

Returns: {Boolean} The layer is displayable at the current map's current resolution. Note that if 'alwaysInRange' is true for the layer, this function will always return true.

Returns

boolean

public calculateResolutions(props: Object): Array<number>

Method: calculateResolutions Calculate resolutions based on the provided properties.

Parameters: props - {Object} Properties

Returns: {Array({Number})} Array of resolutions.

Parameters

  • props: Object

Returns

Array<number>

public clone(): Layer

Method: clone

Parameters: obj - {} The layer to be cloned

Returns: {} An exact clone of this

Returns

Layer

public destroy(setNewBaseLayer?: boolean)

Method: destroy Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own.

Parameters: setNewBaseLayer - {Boolean} Set a new base layer when this layer has been destroyed. Default is true.

Parameters

  • setNewBaseLayer?: boolean optional

public display(display: boolean)

APIMethod: display Hide or show the Layer. This is designed to be used internally, and is not generally the way to enable or disable the layer. For that, use the setVisibility function instead..

Parameters: display - {Boolean}

Parameters

  • display: boolean

private getDataExtent(): Bounds

Method: getDataExtent Calculates the max extent which includes all of the data for the layer. This function is to be implemented by subclasses.

Returns: {}

Returns

Bounds

public getExtent(): Bounds

APIMethod: getExtent

Returns: {} A Bounds object which represents the lon/lat bounds of the current viewPort.

Returns

Bounds

public getImageSize(bounds: Bounds): Size

APIMethod: getImageSize

Parameters: bounds - {} optional tile bounds, can be used by subclasses that have to deal with different tile sizes at the layer extent edges (e.g. Zoomify)

Returns: {} The size that the image should be, taking into account gutters.

Parameters

Returns

Size

public getLonLatFromViewPortPx(viewPortPx: Pixel): LonLat

APIMethod: getLonLatFromViewPortPx

Parameters: viewPortPx - {|Object} An OpenLayers.Pixel or an object with a 'x' and 'y' properties.

Returns: {} An OpenLayers.LonLat which is the passed-in view port , translated into lon/lat by the layer.

Parameters

Returns

LonLat

private getOptions(): LayerOptions

Method: getOptions Extracts an object from the layer with the properties that were set as options, but updates them with the values currently set on the instance.

Returns: {Object} the of the layer, representing the current state.

Returns

LayerOptions

public getResolution(): number

APIMethod: getResolution

Returns: {Float} The currently selected resolution of the map, taken from the resolutions array, indexed by current zoom level.

Returns

number

public getResolutionForZoom(zoom: number): number

APIMethod: getResolutionForZoom

Parameters: zoom - {Float}

Returns: {Float} A suitable resolution for the specified zoom.

Parameters

  • zoom: number

Returns

number

public getViewPortPxFromLonLat(lonlat: LonLat, resolution: number): Pixel

APIMethod: getViewPortPxFromLonLat Returns a pixel location given a map location. This method will return fractional pixel values.

Parameters: lonlat - {|Object} An OpenLayers.LonLat or an object with a 'lon' and 'lat' properties.

Returns: {} An which is the passed-in lonlat translated into view port pixels.

Parameters

  • lonlat: LonLat
  • resolution: number

Returns

Pixel

public getVisibility(): boolean

APIMethod: getVisibility

Returns: {Boolean} The layer should be displayed (if in range).

Returns

boolean

public getZIndex(): number

Method: getZIndex

Returns: {Integer} the z-index of this layer

Returns

number

public getZoomForExtent(extent: Bounds, closest?: boolean): number

APIMethod: getZoomForExtent

Parameters: extent - {} closest - {Boolean} Find the zoom level that most closely fits the specified bounds. Note that this may result in a zoom that does not exactly contain the entire extent. Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) for the passed-in extent. We do this by calculating the ideal resolution for the given extent (based on the map size) and then calling getZoomForResolution(), passing along the 'closest' parameter.

Parameters

  • extent: Bounds
  • closest?: boolean optional

Returns

number

public getZoomForResolution(resolution: number, closest?: boolean): number

APIMethod: getZoomForResolution

Parameters: resolution - {Float} closest - {Boolean} Find the zoom level that corresponds to the absolute closest resolution, which may result in a zoom whose corresponding resolution is actually smaller than we would have desired (if this is being called from a getZoomForExtent() call, then this means that the returned zoom index might not actually contain the entire extent specified... but it'll be close). Default is false.

Returns: {Integer} The index of the zoomLevel (entry in the resolutions array) that corresponds to the best fit resolution given the passed in value and the 'closest' specification.

Parameters

  • resolution: number
  • closest?: boolean optional

Returns

number

public initResolutions()

Method: initResolutions This method's responsibility is to set up the 'resolutions' array for the layer -- this array is what the layer will use to interface between the zoom levels of the map and the resolution display of the layer.

The user has several options that determine how the array is set up.

For a detailed explanation, see the following wiki from the openlayers.org homepage: http://trac.openlayers.org/wiki/SettingZoomLevels

public moveByPx(dx: number, dy: number)

Method: moveByPx Move the layer based on pixel vector. To be implemented by subclasses.

Parameters: dx - {Number} The x coord of the displacement vector. dy - {Number} The y coord of the displacement vector.

Parameters

  • dx: number
  • dy: number

public moveTo(bounds: Bounds, zoomChanged: boolean, dragging: boolean)

Method: moveTo

Parameters: bounds - {} zoomChanged - {Boolean} Tells when zoom has changed, as layers have to do some init work in that case. dragging - {Boolean}

Parameters

  • bounds: Bounds
  • zoomChanged: boolean
  • dragging: boolean

public onMapResize()

This function can be implemented by subclasses

public redraw()

APIMethod: redraw Redraws the layer. Returns true if the layer was redrawn, false if not.

Returns: {Boolean} The layer was redrawn.

public removeMap(map: Map)

APIMethod: removeMap Just as setMap() allows each layer the possibility to take a personalized action on being added to the map, removeMap() allows each layer to take a personalized action on being removed from it. For now, this will be mostly unused, except for the EventPane layer, which needs this hook so that it can remove the special invisible pane.

Parameters: map - {}

Parameters

private resolutionsFromScales(scales: Array<number>): Array<number>

Method: resolutionsFromScales Derive resolutions from scales.

Parameters: scales - {Array(Number)} Scales

Returns {Array(Number)} Resolutions

Parameters

  • scales: Array<number>

Returns

Array<number>

public setIsBaseLayer(isBaseLayer: boolean)

APIMethod: setIsBaseLayer

Parameters: isBaseLayer - {Boolean}

Parameters

  • isBaseLayer: boolean

public setMap(map: Map)

Method: setMap Set the map property for the layer. This is done through an accessor so that subclasses can override this and take special action once they have their map variable set.

Here we take care to bring over any of the necessary default properties from the map.

Parameters: map - {}

Parameters

public setName(newName: string)

APIMethod: setName Sets the new layer name for this layer. Can trigger a changelayer event on the map.

Parameters: newName - {String} The new name.

Parameters

  • newName: string

public setOpacity(opacity: number)

APIMethod: setOpacity Sets the opacity for the entire layer (all images)

Parameters: opacity - {Float}

Parameters

  • opacity: number

public setTileSize(size: Size)

APIMethod: setTileSize Set the tile size based on the map size. This also sets layer.imageSize or use by Tile.Image.

Parameters: size - {}

Parameters

public setVisibility(visibility: boolean)

APIMethod: setVisibility Set the visibility flag for the layer and hide/show & redraw accordingly. Fire event unless otherwise specified

Note that visibility is no longer simply whether or not the layer's style.display is set to "block". Now we store a 'visibility' state property on the layer class, this allows us to remember whether or not we desire for a layer to be visible. In the case where the map's resolution is out of the layer's range, this desire may be subverted.

Parameters: visibility - {Boolean} Whether or not to display the layer (if in range)

Parameters

  • visibility: boolean

public setZIndex(zIndex: number)

Method: setZIndex

Parameters: zIndex - {Integer}

Parameters

  • zIndex: number