OpenLayers

The OpenLayers object provides a namespace for all things OpenLayers

Summary
The OpenLayers object provides a namespace for all things OpenLayers
{String} Relative path of this script.
Return the path to this script.
This is the old $() from prototype
Remove an object from an array.
Deprecated.
Seems to exist already in FF, but not in MOZ.
Modifies many properties of a DOM element all at once.
Creates a new div and optionally set some standard attributes.
Creates an img element with specific attribute values.
Deprecated.
{String} The color tiles with load errors will turn.
{Integer} How many times should we try to reload an image before giving up? 
Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer.
Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored.
Takes a hashtable and copies any keys that don’t exist from another hashtable, by analogy with OpenLayers.Util.extend() from Prototype.js.
{String} Default is ‘’.
{String} The fully formatted image location string
Execute functions until one of them doesn’t throw an error.
These could/should be made namespace aware?
Parse the parameters from a URL or from the current page itself into a JavaScript Object.
{Integer} The ever-incrementing count variable.
prefix {String} String to prefix unique id.
{Object} Constant inches per unit -- borrowed from MapServer mapscale.c
{Integer} 72 (A sensible default)
Deprecated.
Calculates the position of an element on the page.
Test two URLs for equivalence.
Takes a url and removes everything after the ?
{String} A string which specifies which is the current browser in which we are running.
The OpenLayers.Console namespace is used for debugging and error logging.
OpenLayers custom string, number and function functions are described here.
OpenLayers I18n strings in various langauges.
Base class used to construct all other classes.
Deprecated.
Instances of this class represent a width/height pair
Create an instance of OpenLayers.Size
Return the string representation of a size object
Instances of this class represent bounding boxes.
{Number}
{Number}
{Number}
{Number}
Construct a new bounds object.
Create a cloned instance of this bounds.
Test a two bounds for equivalence.
Get the opposite quadrant for a given quadrant string.
This class represents a longitude and latitude pair
Create a new map location.
Return a readable string version of the lonlat
Alternative constructor that builds a new OpenLayers.LonLat from a parameter string
This class represents a screen coordinate, in x and y coordinates
Create a new OpenLayers.Pixel instance
Cast this object into a string
Background load a document.
Parse XML into a doc structure
{Object} Transport mechanism for whichever browser we’re in, or false if none available.
{Integer}
{Object}
{Array}
{Object}
{Boolean}
{Boolean}
{?}
{?}
{?}
{Array(String)}
Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.
Controls affect the display or behavior of the map.
{String}
{OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map
{DOMElement}
{OpenLayers.Control.TYPES} Controls can have a ‘type’.
{string} This property is used for CSS related to the drawing of the Control.
{boolean} null
Create an OpenLayers Control.
The destroy method is used to perform any clean up before the control is dereferenced.
Set the map property for the control.
The draw method is called when the control is ready to be displayed on the page.
Sets the left and top style attributes to the passed in pixel coordinates.
Explicitly activates a control and it’s associated handler if one has been set.
Deactivates a control and it’s associated handler if any.
The icon represents a graphical icon on the screen.
{String} image url
{OpenLayers.Pixel} distance in pixels to offset the image when being rendered
{OpenLayers.Pixel} Function to calculate the offset (based on the size)
{DOMElement}
Creates an icon, which is an image tag in a div.
Nullify references and remove event listeners to prevent circular references and memory leaks
{OpenLayers.Icon} A fresh copy of the icon.
Move the div to the given pixel.
Change the icon’s opacity
move icon to passed in px.
Hide or show the icon
Set the map property for the control.
As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler.
As soon as all the layers are loaded, cycle through them and hide or show them.
{Array(DOMElement)} Array of Button Divs
{Integer}
{Integer}
Utility functions for event handling.
{Object} A hashtable cache of the event observers.
{int}
{int}
{int}
{int}
{int}
{int}
{int}
{int}
{int}
Cross browser event element detection.
Determine whether event was caused by a left click.
Stops an event from propagating.
Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed.
Cycle through all the element entries in the events cache and call stopObservingElement on each.
{Array(String)} supported events
{Object} Hashtable of Array(Function): events listener functions
{Object} the code object issuing application events
{DOMElement} the DOM element receiving browser events
{Array(String)} list of support application events
{Function} bound event handler attached to elements
Construct an OpenLayers.Events object.
Remove all listeners for a given event type.
Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position.
Class for coordinate transformations between coordinate systems.
This class offers several methods for interacting with a wrapped pro4js projection object.
This is a class designed to designate a single tile, however it is explicitly designed to do relatively little.
{Array(String)} Supported application event types
{String} null
{OpenLayers.Layer} layer the tile is attached to
{String} url of the request.
{OpenLayers.Pixel} Top Left pixel of the tile
{Boolean} Is the tile loading?
Constructor for a new OpenLayers.Tile instance.
Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn.
Reposition the tile.
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine.
Create an overview map to display the extent of your main map and provide additional navigation control.
{String} For div.id
{DOMElement} The DOM element that contains the overview map
Create a new overview map
Render the control in the browser.
Handle browser events
Handle browser events
Handle browser events
Handle browser events
Handle browser events
Handle browser events
Unhide the control.
Hide all the contents of the control, shrink the size, add the maximize icon
Hide/Show the toggle depending on whether the control is minimized
Update the overview map after layers move.
Determines if the overview map is suitable given the extent and resolution of the main map.
Construct the map that this control contains
Updates the extent rectangle position and size to match the map extent
Updates the map extent to match the extent rectangle position and size
Get extent rectangle pixel bounds
Set extent rectangle pixel bounds.
Get the rect bounds from the map bounds.
Get the map bounds from the rect bounds.
Get a map location from a pixel location
Get a pixel location from a map location
Base class to construct a higher-level handler for event sequences.
{String}
{Boolean}
{Event} This property references the last event handled by the handler.
Construct a handler.
Check the keyMask on the handler.
Trigger the control’s named callback with the given arguments
register an event on the map
unregister an event from the map
With each registered browser event, the handler sets its own evt property.
Deconstruct the handler.
If set as the <keyMask>, checkModifiers returns false if any key is down.
If set as the <keyMask>, checkModifiers returns false if Shift is down.
If set as the <keyMask>, checkModifiers returns false if Ctrl is down.
If set as the <keyMask>, checkModifiers returns false if Alt is down.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
{Object} Base z-indexes for different classes of thing
{Array(String)} supported application event types
{String} Unique identifier for the map
{OpenLayers.Size} Size of the main div (this.div)
{HTMLDivElement} The element that represents the map viewport
{OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom)
{HTMLDivElement} The element that contains the layers.
{Array(OpenLayers.Layer)} Ordered list of layers in the map
{Array(OpenLayers.Control)} List of controls associated with the map
{Array(<OpenLayers.Popup>)} List of popups associated with the map
{OpenLayers.LonLat} The current center of the map
{Integer} The current zoom level of the map
{String} Used to store a unique identifier that changes when the map view changes.
Constructor for a new OpenLayers.Map instance.
Function that is called to destroy the map on page unload.
{OpenLayers.Size} A new OpenLayers.Size object with the dimensions of the map div
This function takes care to recenter the layerContainerDiv.
{Integer} 256 Default tile width (unless otherwise specified)
{Integer} 256 Default tile height (unless otherwise specified)
Instances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon.
{OpenLayers.Icon} The icon used by this marker.
{OpenLayers.LonLat} location of object
{OpenLayers.Events} the event handler.
{OpenLayers.Map} the map this marker is attached to
Calls draw on the icon, and returns that output.
Move the marker to the new location.
{Boolean} Whether or not the marker is currently visible on screen.
Englarges the markers icon by the specified ratio.
Change the opacity of the marker by changin the opacity of its icon
Hide or show the icon
Creates a default OpenLayers.Icon.
Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers.
{String} The URL of the image being requested.
{DOMElement} The div element which wraps the image.
{DOMElement} The image element is appended to the frame.
Constructor for a new OpenLayers.Tile.Image instance.
Check that a tile should be drawn, and draw it.
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
Creates the imgDiv property on the tile.
Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime.
A handler for mouse clicks.
{Number} The id of the timeout waiting to clear the <delayedEvent>.
{OpenLayers.Pixel} The pixel location of the last mousedown.
Create a new click handler.
Handle mousedown.
Handle dblclick.
Handle click.
Determine whether the event is within the optional pixel tolerance.
Clear the timer and set timerId to null.
Sets timerId to null.
The drag handler is used to deal with sequences of browser events related to dragging.
{Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting.
{Boolean}
{OpenLayers.Pixel} The last pixel location of the drag.
{OpenLayers.Pixel} The first pixel location of the drag.
{Function}
Returns OpenLayers.Handler.Drag
This method is called during the handling of the mouse down event.
This method is called during the handling of the mouse move event.
This method is called during the handling of the mouse up event.
This method is called during the handling of the mouse out event.
Handle mousedown events
Handle mousemove events
Handle mouseup events
Handle mouseout events
The drag handler captures the click event.
Activate the handler.
Deactivate the handler.
Handler for wheel up/down events.
{function}
{OpenLayers.Pixel} mousePosition is necessary because evt.clientX/Y is buggy in Moz on wheel events, so we cache and use the value from the last mousemove.
Catch the wheel event and handle it xbrowserly
Update the stored mousePosition on every move.
{Array(String)} Supported application event types
{Boolean} The layer’s images have an alpha channel.
{Boolean} The current map resolution is within the layer’s min/max range.
{OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter.
{Object} An optional object whose properties will be set on the layer.
Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own.
Set the map property for the layer.
{Boolean} The layer is displayable at the current map’s current resolution.
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.
Calculates the max extent which includes all of the data for the layer.
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.
{DOMElement}
Allow the user to change the box’s color and border width
{Boolean} Whether or not the marker is currently visible on screen.
Hide or show the icon
DragPan control.
{OpenLayers.Control.TYPES}
{Boolean} The map moved.
Creates a Drag handler, using <OpenLayers.Control.PanMap.panMap> and <OpenLayers.Control.PanMap.panMapDone> as callbacks.
Finish the panning operation.
Handler for dragging a rectangle across the map.
Remove the zoombox from the screen and nullify our reference to it.
{Float} Used to hash URL param strings for multi-WMS server selection.
{Array(String) or String} This is either an array of url strings or a single url string.
{Object} Hashtable of key/value parameters
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.
Combine url with layer’s params and these newParams.
Array({OpenLayers.Marker}) internal marker list
{Boolean} internal state of drawing.
Create a Markers layer.
This method removes all markers from a layer.
Calculate the pixel location for the marker, create it, and add it to the layer’s div
{OpenLayers.Control.TYPE}
Base class for layers that use a lattice of tiles.
{Array(Array(OpenLayers.Tile))} This is an array of rows, each row is an array of tiles.
Create a new grid layer
Go through and remove all tiles from the grid, calling destroy() on each of them to kill circular references
This function is called whenever the map is moved.
Deprecated.
Starts at the top right corner of the grid and proceeds in a spiral towards the center, adding tiles one at a time to the beginning of a queue.
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.
This function takes a tile as input and removes the tile hooks that were added in addTileMonitoringHooks()
Shifty grid work
Shift grid work in the other dimension
When the size of the map or the buffer changes, we may need to remove some excess rows and columns.
For singleTile layers, this will replace the tile with the a new one with updated tileSize and extent.
The navigation control handles map browsing with mouse events (dragging, double-clicking, and scrolling the wheel).
Create a new navigation control
User spun scroll wheel up
User spun scroll wheel down
Instances of OpenLayers.Layer.MapGuide are used to display data from a MapGuide OS instance.
{Object} Hashtable of default parameter key/value pairs
Instances of OpenLayers.Layer.MapServer are used to display data from a MapServer CGI instance.
{Object} Hashtable of default parameter key/value pairs
Create a new MapServer layer object
Create a clone of this layer
Creates a tile, initializes it, and adds it to the layer div.
Return a query string for this layer
combine the layer’s url with its params and these newParams.
Instances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services.
{Object} Hashtable of default parameter key/value pairs
Deprecated.
Create a new WMS layer object
Destroy this layer
Create a clone of this layer
Return a GetMap query string for this layer
addTile creates a tile, initializes it, and adds it to the layer div.
Combine the layer’s url with its params and these newParams.

Properties

_scriptName

{String} Relative path of this script.

Functions

_getScriptLocation

_getScriptLocation: function ()

Return the path to this script.

Returns

Path to this script

Constants

VERSION_NUMBER

Util

Summary
This is the old $() from prototype
Remove an object from an array.
Deprecated.
Seems to exist already in FF, but not in MOZ.
Modifies many properties of a DOM element all at once.
Creates a new div and optionally set some standard attributes.
Creates an img element with specific attribute values.
Deprecated.
{String} The color tiles with load errors will turn.
{Integer} How many times should we try to reload an image before giving up? 
Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer.
Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored.
Takes a hashtable and copies any keys that don’t exist from another hashtable, by analogy with OpenLayers.Util.extend() from Prototype.js.
{String} Default is ‘’.
{String} The fully formatted image location string
Execute functions until one of them doesn’t throw an error.
These could/should be made namespace aware?
Parse the parameters from a URL or from the current page itself into a JavaScript Object.
{Integer} The ever-incrementing count variable.
prefix {String} String to prefix unique id.
{Object} Constant inches per unit -- borrowed from MapServer mapscale.c
{Integer} 72 (A sensible default)
Deprecated.
Calculates the position of an element on the page.
Test two URLs for equivalence.
Takes a url and removes everything after the ?
{String} A string which specifies which is the current browser in which we are running.

Functions and Properties

getElement

OpenLayers.Util.getElement = function()

This is the old $() from prototype

removeItem

OpenLayers.Util.removeItem = function(array,
item)

Remove an object from an array.  Iterates through the array to find the item, then removes it.

Parameters

array{Array}
item{Object}

Return {Array} A reference to the array

clearArray

OpenLayers.Util.clearArray = function(array)

Deprecated.  This function will disappear in 3.0.  Please use “array.length = 0” instead.

Parameters

array{Array}

indexOf

OpenLayers.Util.indexOf = function(array,
obj)

Seems to exist already in FF, but not in MOZ.

Parameters

array{Array}
obj{Object}

Returns

{Integer} The index at, which the object was found in the array.  If not found, returns -1.v

modifyDOMElement

OpenLayers.Util.modifyDOMElement = function(element,
id,
px,
sz,
position,
border,
overflow,
opacity)

Modifies many properties of a DOM element all at once.  Passing in null to an individual parameter will avoid setting the attribute.

Parameters

id{String} The element id attribute to set.
px{OpenLayers.Pixel} The left and top style position.
sz{OpenLayers.Size} The width and height style attributes.
position{String} The position attribute.  eg: absolute, relative, etc.
border{String} The style.border attribute.  eg: solid black 2px
overflow{String} The style.overview attribute.
opacity{Float} Fractional value (0.0 - 1.0)

createDiv

Creates a new div and optionally set some standard attributes.  Null may be passed to each parameter if you do not wish to set a particular attribute.d

zIndex is NOT set

Parameters

id{String} An identifier for this element.  If no id is passed an identifier will be created automatically.
px{OpenLayers.Pixel} The element left and top position.
sz{OpenLayers.Size} The element width and height.
imgURL{String} A url pointing to an image to use as a background image.
position{String} The style.position value. eg: absolute, relative etc.
border{String} The the style.border value. eg: 2px solid black
overflow{String} The style.overflow value.  Eg. hidden
opacity{Float} Fractional value (0.0 - 1.0)

Returns

{DOMElement} A DOM Div created with the specified attributes.

createImage

OpenLayers.Util.createImage = function(id,
px,
sz,
imgURL,
position,
border,
opacity,
delayDisplay)

Creates an img element with specific attribute values.

Parameters

id{String} The id field for the img.  If none assigned one will be automatically generated.
px{OpenLayers.Pixel} The left and top positions.
sz{OpenLayers.Size} The style.width and style.height values.
imgURL{String} The url to use as the image source.
position{String} The style.position value.
border{String} The border to place around the image.
delayDisplay{Boolean} If true waits until the image has been loaded.
opacity{Float} Fractional value (0.0 - 1.0)

Returns

{DOMElement} A DOM Image created with the specified attributes.

setOpacity

OpenLayers.Util.setOpacity = function(element,
opacity)

Deprecated.  This function has been deprecated.  Instead, please use OpenLayers.Util.modifyDOMElement() or OpenLayers.Util.modifyAlphaImageDiv()

Set the opacity of a DOM Element Note that for this function to work in IE, elements must “have layout” according to: http://msdn.microsoft.com- /workshop- /author- /dhtml- /reference- /properties- /haslayout.asp

Parameters

element{DOMElement} Set the opacity on this DOM element
opacity{Float} Opacity value (0.0 - 1.0)

onImageLoad

OpenLayers.Util.onImageLoad = function()

onImageLoadErrorColor

{String} The color tiles with load errors will turn.  Default is “pink”

onImageLoadErrorColor

{Integer} How many times should we try to reload an image before giving up?  Default is 0

onImageLoadError

OpenLayers.Util.onImageLoadError = function()

alphaHack

OpenLayers.Util.alphaHack = function()

Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer.

Returns

{Boolean} true if alpha has is necessary and possible, false otherwise.

modifyAlphaImageDiv

OpenLayers.Util.modifyAlphaImageDiv = function(div,
id,
px,
sz,
imgURL,
position,
border,
sizing,
opacity)
div{DOMElement} Div containing Alpha-adjusted Image
id{String}
px{OpenLayers.Pixel}
sz{OpenLayers.Size}
imgURL{String}
position{String}
border{String} sizing {String} ‘crop’, ‘scale’, or ‘image’.  Default is “scale”
opacity{Float} Fractional value (0.0 - 1.0)

createAlphaImageDiv

OpenLayers.Util.createAlphaImageDiv = function(id,
px,
sz,
imgURL,
position,
border,
sizing,
opacity,
delayDisplay)
id{String}
px{OpenLayers.Pixel}
sz{OpenLayers.Size}
imgURL{String}
position{String}
border{String} sizing {String} ‘crop’, ‘scale’, or ‘image’.  Default is “scale” delayDisplay{Boolean}

Returns

{DOMElement} A DOM Div created with a DOM Image inside it.  If the hack is needed for transparency in IE, it is added.

upperCaseObject

OpenLayers.Util.upperCaseObject = function (object)

Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored.

Parameters

object{Object}

Returns

{Object} A new Object with all the same keys but uppercased

applyDefaults

OpenLayers.Util.applyDefaults = function (to,
from)

Takes a hashtable and copies any keys that don’t exist from another hashtable, by analogy with OpenLayers.Util.extend() from Prototype.js.

Parameters

to{Object}
from{Object}

getParameterString

OpenLayers.Util.getParameterString = function(params)

Parameters

params{Object}

Returns

{String} A concatenation of the properties of an object in http parameter notation.  (ex.  <i>”key1=value1&key2=value2&key3=value3”</i>) If a parameter is actually a list, that parameter will then be set to a comma-seperated list of values (foo,bar) instead of being URL escaped (foo%3Abar).

ImgPath

{String} Default is ‘’.

getImagesLocation

OpenLayers.Util.getImagesLocation = function()

Returns

{String} The fully formatted image location string

Try

OpenLayers.Util.Try = function()

Execute functions until one of them doesn’t throw an error.  Capitalized because “try” is a reserved word in JavaScript.  Taken directly from OpenLayers.Util.Try()

Parameters

[*]{Function} Any number of parameters may be passed to Try() It will attempt to execute each of them until one of them successfully executes.  If none executes successfully, returns null.

Returns

{*} The value returned by the first successfully executed function.

getNodes

OpenLayers.Util.getNodes=function(p,
tagName)

These could/should be made namespace aware?

Parameters

p{}
tagName{String}

Returns

{Array}

_getNodes

OpenLayers.Util._getNodes=function(nodes,
tagName)

Parameters

nodes{Array}
tagName{String}

Returns

{Array}

getTagText

OpenLayers.Util.getTagText = function (parent,
item,
index)

Parameters

parent{}
item{String}
index{Integer}

Returns

{String}

getXmlNodeValue

OpenLayers.Util.getXmlNodeValue = function(node)

Parameters

node{XMLNode}

Returns

{String} The text value of the given node, without breaking in firefox or IE

mouseLeft

OpenLayers.Util.mouseLeft = function (evt,
div)

Parameters

evt{Event}
div{HTMLDivElement}

Returns

{Boolean}

rad

OpenLayers.Util.rad = function(x)

Parameters

x{Float}

Returns

{Float}

distVincenty

OpenLayers.Util.distVincenty=function(p1,
p2)

Parameters

p1{Float}
p2{Float}

Returns

{Float}

getParameters

OpenLayers.Util.getParameters = function(url)

Parse the parameters from a URL or from the current page itself into a JavaScript Object.  Note that parameter values with commas are separated out into an Array.

Parameters

url{String} Optional url used to extract the query string.  If null, query string is taken from page location.

Returns

{Object} An object of key/value pairs from the query string.

getArgs

OpenLayers.Util.getArgs = function(url)
DeprecatedWill be removed in 3.0.  Please use instead OpenLayers.Util.getParameters

Parameters

url{String} Optional url used to extract the query string.  If null, query string is taken from page location.

Returns

{Object} An object of key/value pairs from the query string.

lastSeqID

{Integer} The ever-incrementing count variable.  Used for generating unique ids.

createUniqueID

OpenLayers.Util.createUniqueID = function(prefix)

Parameters

prefix {String} String to prefix unique id.  If null, default is “id_”

Returns

{String} A unique id string, built on the passed in prefix

Constants

INCHES_PER_UNIT

{Object} Constant inches per unit -- borrowed from MapServer mapscale.c

DOTS_PER_INCH

{Integer} 72 (A sensible default)

Functions

normalzeScale

Parameters

scale{float}

Returns

{Float} A normalized scale value, in 1 / X format.  This means that if a value less than one ( already 1/x) is passed in, it just returns scale directly.  Otherwise, it returns 1 / scale

getResolutionFromScale

OpenLayers.Util.getResolutionFromScale = function (scale,
units)

Parameters

scale{Float}
units{String} Index into OpenLayers.INCHES_PER_UNIT hashtable.  Default is degrees

Returns

{Float} The corresponding resolution given passed-in scale and unit parameters.

getScaleFromResolution

OpenLayers.Util.getScaleFromResolution = function (resolution,
units)

Parameters

resolution{Float}
units{String} Index into OpenLayers.INCHES_PER_UNIT hashtable.  Default is degrees

Returns

{Float} The corresponding scale given passed-in resolution and unit parameters.

safeStopPropagation

OpenLayers.Util.safeStopPropagation = function(evt)

Deprecated.

This function has been deprecated.  Please use directly OpenLayers.Event.stop() passing ‘true’ as the 2nd argument (preventDefault)

Safely stop the propagation of an event without preventing the default browser action from occurring.

Parameter

evt{Event}

pagePositon

Calculates the position of an element on the page.

Parameters

forElement{DOMElement}

Returns:´ {Array} two item array, L value then T value.

isEquivalentUrl

OpenLayers.Util.isEquivalentUrl = function(url1,
url2,
options)

Test two URLs for equivalence.

Setting ‘ignoreCase’ allows for case-independent comparison.

Comparison is based on

  • Protocol
  • Host (evaluated without the port)
  • Port (set ‘ignorePort80’ to ignore “80” values)
  • Hash ( set ‘ignoreHash’ to disable)
  • Pathname (for relative <-> absolute comparison)
  • Arguments (so they can be out of order)

Parameters

url1{String}
url2{String}
options{Object} Allows for customization of comparison:
’ignoreCase’Default is True
’ignorePort80’Default is True
’ignoreHash’Default is True

Returns

{Boolean} Whether or not the two URLs are equivalent

createUrlObject

OpenLayers.Util.createUrlObject = function(url,
options)

Parameters

url{String}
options{Object} A hash of options.  Can be one of: ignoreCase: lowercase url, ignorePort80: don’t include explicit port if port is 80, ignoreHash: Don’t include part of url after the hash (#).

Returns

{Object} An object with separate url, a, port, host, and args parsed out and ready for comparison

removeTail

OpenLayers.Util.removeTail = function(url)

Takes a url and removes everything after the ? and #

Parameters

url{String} The url to process

Returns

{String} The string with all queryString and Hash removed

getBrowserName

OpenLayers.Util.getBrowserName = function()

Returns

{String} A string which specifies which is the current browser in which we are running.

Currently-supported browser detection and codes

  • ’opera’ -- Opera
  • ’msie’ -- Internet Explorer
  • ’safari’ -- Safari
  • ’firefox’ -- FireFox
  • ’mozilla’ -- Mozilla

If we are unable to property identify the browser, we return an empty string.

OpenLayers. Console

The OpenLayers.Console namespace is used for debugging and error logging.  If the Firebug Lite (../Firebug/firebug.js) is included before this script, calls to OpenLayers.Console methods will get redirected to window.console.  This makes use of the Firebug extension where available and allows for cross-browser debugging Firebug style.

Note

Note that behavior will differ with the Firebug extention and Firebug Lite.  Most notably, the Firebug Lite console does not currently allow for hyperlinks to code or for clicking on object to explore their properties.

Summary
OpenLayers custom string, number and function functions are described here.
OpenLayers I18n strings in various langauges.
Base class used to construct all other classes.
Deprecated.

Files

OpenLayers Base Types

OpenLayers custom string, number and function functions are described here.

OpenLayers Strings

OpenLayers I18n strings in various langauges.  Default language is English, langcode=’en’

Functions

OpenLayers. Class

OpenLayers.Class = function()

Base class used to construct all other classes.  Includes support for multiple inheritance.

This constructor is new in OpenLayers 2.5.  At OpenLayers 3.0, the old syntax for creating classes and dealing with inheritance will be removed.

To create a new OpenLayers-style class, use the following syntax

var MyClass = OpenLayers.Class(prototype);

To create a new OpenLayers-style class with multiple inheritance, use the following syntax:

var MyClass = OpenLayers.Class(Class1, Class2, prototype);

Properties

isPrototype

Deprecated.  This is no longer needed and will be removed at 3.0.

OpenLayers.Size

Instances of this class represent a width/height pair

Summary
Create an instance of OpenLayers.Size
Return the string representation of a size object

Functions

OpenLayers.Size

Create an instance of OpenLayers.Size

Parameters

w{Number} width
h{Number} height

toString

toString:function()

Return the string representation of a size object

Returns

{String} The string representation of OpenLayers.Size object.  (ex.  <i>”w=55,h=66”</i>)

OpenLayers. Bounds

Instances of this class represent bounding boxes.  Data stored as left, bottom, right, top floats.  All values are initialized to null, however, you should make sure you set them before using the bounds for anything.

Possible use case

bounds = new OpenLayers.Bounds();
bounds.extend(new OpenLayers.LonLat(4,5));
bounds.extend(new OpenLayers.LonLat(5,6));
bounds.toBBOX(); // returns 4,5,5,6
Summary
{Number}
{Number}
{Number}
{Number}
Construct a new bounds object.
Create a cloned instance of this bounds.
Test a two bounds for equivalence.
Get the opposite quadrant for a given quadrant string.

Properties

left

{Number}

bottom

{Number}

right

{Number}

top

{Number}

Functions

OpenLayers. Bounds

Construct a new bounds object.

Parameters

left{Number} The left bounds of the box.  Note that for width calculations, this is assumed to be less than the right value.
bottom{Number} The bottom bounds of the box.  Note that for height calculations, this is assumed to be more than the top value.
right{Number} The right bounds.
top{Number} The top bounds.

clone

clone:function()

Create a cloned instance of this bounds.

Returns

{OpenLayers.Bounds} A fresh copy of the bounds

equals

equals:function(bounds)

Test a two bounds for equivalence.

Parameters

bounds{OpenLayers.Bounds}

Returns

{Boolean} The passed-in bounds object has the same left, right, top, bottom components as this.  Note that if bounds passed in is null, returns false.

oppositeQuadrant

OpenLayers.Bounds.oppositeQuadrant = function(quadrant)

Get the opposite quadrant for a given quadrant string.

Parameters

quadrant{String} two character quadrant shortstring

Returns

{String} The opposing quadrant (“br” “tr” “tl” “bl”).  For Example, if you pass in “bl” it returns “tr”, if you pass in “br” it returns “tl”, etc.

OpenLayers. Element

OpenLayers. LonLat

This class represents a longitude and latitude pair

Summary
Create a new map location.
Return a readable string version of the lonlat
Alternative constructor that builds a new OpenLayers.LonLat from a parameter string

Functions

OpenLayers. LonLat

Create a new map location.

Parameters

lon{Number} The x-axis coordinate in map units.  If your map is in a geographic projection, this will be the Longitude.  Otherwise, it will be the x coordinate of the map location in your map units.
lat{Number} The y-axis coordinate in map units.  If your map is in a geographic projection, this will be the Latitude.  Otherwise, it will be the y coordinate of the map location in your map units.

toString

toString:function()

Return a readable string version of the lonlat

Returns

{String} String representation of OpenLayers.LonLat object.  (ex.  <i>”lon=5,lat=42”</i>)

fromString

OpenLayers.LonLat.fromString = function(str)

Alternative constructor that builds a new OpenLayers.LonLat from a parameter string

Parameters

str{String} Comma-separated Lon,Lat coordinate string.  (ex.  <i>”5,40”</i>)

Returns

{OpenLayers.LonLat} New OpenLayers.LonLat object built from the passed-in String.

OpenLayers. Pixel

This class represents a screen coordinate, in x and y coordinates

Summary
Create a new OpenLayers.Pixel instance
Cast this object into a string
Background load a document.
Parse XML into a doc structure

Functions

OpenLayers. Pixel

Create a new OpenLayers.Pixel instance

Parameters

x{Number} The x coordinate
y{Number} The y coordinate

Returns

An instance of OpenLayers.Pixel

toString

toString:function()

Cast this object into a string

Returns

{String} The string representation of Pixel. ex: “x=200.4,y=242.2”

loadURL

OpenLayers.loadURL = function(uri,
params,
caller,
onComplete,
onFailure)

Background load a document.

Parameters

uri{String} URI of source doc
params{String} Params on get (doesnt seem to work)
caller{Object} object which gets callbacks
onComplete{Function} callback for success
onFailure{Function} callback for failure

Both callbacks optional (though silly)

parseXMLString

OpenLayers.parseXMLString = function(text)

Parse XML into a doc structure

Parameters

text{String}

Returns

{?}  Parsed AJAX Responsev

OpenLayers.Ajax

Summary
{Object} Transport mechanism for whichever browser we’re in, or false if none available.
{Integer}

Functions

emptyFunction

emptyFunction: function ()

getTransport

getTransport: function()

Returns

{Object} Transport mechanism for whichever browser we’re in, or false if none available.

Properties

activeRequestCount

{Integer}

OpenLayers. Ajax. Responders

Properties

responders

{Array}

Functions

register

register: function(responderToAdd)

Parameters

responderToAdd{?}

dispatch

dispatch: function(callback,
request,
transport,
json)

Parameters

callback{?}
request{?}
transport{?}
json{?}

onCreate

onCreate: function()

onComplete

onComplete: function()

OpenLayers. Ajax.Base

Functions

setOptions

setOptions: function(options)

Parameters

options{Object}

responseIsSuccess

responseIsSuccess: function()

Returns

{Boolean}

responseIsFailure

responseIsFailure: function()

Returns

{Boolean}

Functions and Properties

OpenLayers. Ajax. Request

Parameters

url{String}
options{Object}

request

request: function(url)

Parameters

url{String}

setRequestHeaders

setRequestHeaders: function()

onStateChange

onStateChange: function()

header

header: function(name)

Returns

{?}

evalJSON

evalJSON: function()

Returns

{?}

evalResponse

evalResponse: function()

Returns

{?}

respondToReadyState

respondToReadyState: function(readyState)

Parameters

readyState{?}

dispatchException

dispatchException: function(exception)

Parameters

exception{?}

Events

{Array(String)}

getElementsByTagNameNS

OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode,
nsuri,
nsprefix,
tagname)

Parameters

parentnode{?}
nsuri{?}
nsprefix{?}
tagname{?}

Returns

{?}

serializeXMLToString

OpenLayers.Ajax.serializeXMLToString = function(xmldom)

Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.  We need to come up with a way to serialize in those browser: for now, these browsers will just fail.  #535, #536

Parameters

xmldom {XMLNode} xml dom to serialize

Returns

{?}

OpenLayers. Control

Controls affect the display or behavior of the map.  They allow everything from panning and zooming to displaying a scale indicator.  Controls by default are added to the map they are contained within however it is possible to add a control to an external div by passing the div in the options parameter.

Example

The following example shows how to add many of the common controls to a map.

var map = new OpenLayers.Map('map', { controls: [] });

map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseToolbar());
map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
map.addControl(new OpenLayers.Control.Permalink());
map.addControl(new OpenLayers.Control.Permalink('permalink'));
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.OverviewMap());
map.addControl(new OpenLayers.Control.KeyboardDefaults());

The next code fragment is a quick example of how to intercept shift-mouse click to display the extent of the bounding box dragged out by the user.  Usually controls are not created in exactly this manner.  See the source for a more complete example:

var control = new OpenLayers.Control();
OpenLayers.Util.extend(control, {
draw: function () {
// this Handler.Box will intercept the shift-mousedown
// before Control.MouseDefault gets to see it
this.box = new OpenLayers.Handler.Box( control,
{"done": this.notice},
{keyMask: OpenLayers.Handler.MOD_SHIFT});
this.box.activate();
},

notice: function (bounds) {
alert(bounds);
}
});
map.addControl(control);
Summary
{String}
{OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map
{DOMElement}
{OpenLayers.Control.TYPES} Controls can have a ‘type’.
{string} This property is used for CSS related to the drawing of the Control.
{boolean} null
Create an OpenLayers Control.
The destroy method is used to perform any clean up before the control is dereferenced.
Set the map property for the control.
The draw method is called when the control is ready to be displayed on the page.
Sets the left and top style attributes to the passed in pixel coordinates.
Explicitly activates a control and it’s associated handler if one has been set.
Deactivates a control and it’s associated handler if any.

Properties

id

{String}

map

{OpenLayers.Map} this gets set in the addControl() function in OpenLayers.Map

div

{DOMElement}

type

{OpenLayers.Control.TYPES} Controls can have a ‘type’.  The type determines the type of interactions which are possible with them when they are placed into a toolbar.

displayClass

{string} This property is used for CSS related to the drawing of the Control.

active

{boolean} null

handler

Functions

OpenLayers. Control

Create an OpenLayers Control.  The options passed as a parameter directly extend the control.  For example passing the following:

var control = new OpenLayers.Control({div: myDiv});

Overrides the default div attribute value of null.

Parameters

options{Object}

destroy

destroy: function ()

The destroy method is used to perform any clean up before the control is dereferenced.  Typically this is where event listeners are removed to prevent memory leaks.

setMap

setMap: function(map)

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

Parameters

map{OpenLayers.Map}

draw

draw: function (px)

The draw method is called when the control is ready to be displayed on the page.  If a div has not been created one is created.  Controls with a visual component will almost always want to override this method to customize the look of control.

Parameters

px{OpenLayers.Pixel} The top-left pixel position of the control or null.

Returns

{DOMElement} A reference to the DIV DOMElement containing the control

moveTo

moveTo: function (px)

Sets the left and top style attributes to the passed in pixel coordinates.

Parameters

px{OpenLayers.Pixel}

activate

activate: function ()

Explicitly activates a control and it’s associated handler if one has been set.  Controls can be deactivated by calling the deactivate() method.

Returns

{Boolean} True if the control was successfully activated or false if the control was already active.

deactivate

deactivate: function ()

Deactivates a control and it’s associated handler if any.  The exact effect of this depends on the control itself.

Returns

{Boolean} True if the control was effectively deactivated or false if the control was already inactive.

OpenLayers.Icon

The icon represents a graphical icon on the screen.  Typically used in conjunction with a OpenLayers.Marker to represent markers on a screen.

An icon has a url, size and position.  It also contains an offset which allows the center point to be represented correctly.  This can be provided either as a fixed offset or a function provided to calculate the desired offset.

Summary
{String} image url
{OpenLayers.Pixel} distance in pixels to offset the image when being rendered
{OpenLayers.Pixel} Function to calculate the offset (based on the size)
{DOMElement}
Creates an icon, which is an image tag in a div.
Nullify references and remove event listeners to prevent circular references and memory leaks
{OpenLayers.Icon} A fresh copy of the icon.
Move the div to the given pixel.
Change the icon’s opacity
move icon to passed in px.
Hide or show the icon

Properties

url

{String} image url

offset

{OpenLayers.Pixel} distance in pixels to offset the image when being rendered

calculateOffset

{OpenLayers.Pixel} Function to calculate the offset (based on the size)

imageDiv

{DOMElement}

Functions

OpenLayers.Icon

Creates an icon, which is an image tag in a div.

url{String}
size{OpenLayers.Size}
calculateOffset{Function}

destroy

destroy: function()

Nullify references and remove event listeners to prevent circular references and memory leaks

clone

clone: function()

Returns

{OpenLayers.Icon} A fresh copy of the icon.

setSize

setSize: function(size)
size{OpenLayers.Size}

draw

draw: function(px)

Move the div to the given pixel.

Parameters

px{OpenLayers.Pixel}

Returns

{DOMElement} A new DOM Image of this icon set at the location passed-in

setOpacity

setOpacity: function(opacity)

Change the icon’s opacity

Parameters

opacity{float}

moveTo

moveTo: function (px)

move icon to passed in px.

Parameters

px{OpenLayers.Pixel}

display

display: function(display)

Hide or show the icon

Parameters

display{Boolean}

OpenLayers. Control. ArgParser

Inherits from

Summary
Set the map property for the control.
As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler.
As soon as all the layers are loaded, cycle through them and hide or show them.

Functions

OpenLayers. Control. ArgParser

Parameters

options{Object}

setMap

setMap: function(map)

Set the map property for the control.

Parameters

map{OpenLayers.Map}

setCenter

setCenter: function()

As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler.

configureLayers

configureLayers: function()

As soon as all the layers are loaded, cycle through them and hide or show them.

OpenLayers. PanZoom

Properties

buttons

{Array(DOMElement)} Array of Button Divs

Functions

OpenLayers. Control. PanZoom

Parameters

options{Object}

draw

draw: function(px)

Parameters

px{OpenLayers.Pixel}

Returns

{DOMElement} A reference to the container div for the PanZoom control.

_addButton

_addButton:function(id,
img,
xy,
sz)

Parameters

id{String}
img{String}
xy{OpenLayers.Pixel}
sz{OpenLayers.Size}

Returns

{DOMElement} A Div (an alphaImageDiv, to be precise) that contains the image of the button, and has all the proper event handlers set.

doubleClick

doubleClick: function (evt)

Parameters

evt{Event}

Returns

{Boolean}

buttonDown

buttonDown: function (evt)

Parameters

evt{Event}

Constants

X

{Integer}

Y

{Integer}

OpenLayers. Event

Utility functions for event handling.

Summary
{Object} A hashtable cache of the event observers.
{int}
{int}
{int}
{int}
{int}
{int}
{int}
{int}
{int}
Cross browser event element detection.
Determine whether event was caused by a left click.
Stops an event from propagating.
Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed.
Cycle through all the element entries in the events cache and call stopObservingElement on each.

Properties

observers

{Object} A hashtable cache of the event observers.  Keyed by element._eventCacheID

Constants

KEY_BACKSPACE

{int}

KEY_TAB

{int}

KEY_RETURN

{int}

KEY_ESC

{int}

KEY_LEFT

{int}

KEY_UP

{int}

KEY_RIGHT

{int}

KEY_DOWN

{int}

KEY_DELETE

{int}

Functions

element

element: function(event)

Cross browser event element detection.

Parameters

event{Event}

Returns

{DOMElement} The element that caused the event

isLeftClick

isLeftClick: function(event)

Determine whether event was caused by a left click.

Parameters

event{Event}

Returns

{Boolean}

stop

stop: function(event,
allowDefault)

Stops an event from propagating.

Parameters

event{Event}
allowDefault{Boolean} If true, we stop the event chain but still allow the default browser behaviour (text selection, radio-button clicking, etc) Default false

findElement

findElement: function(event,
tagName)

Parameters

event{Event}
tagName{String}

Returns

{DOMElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards

observe

observe: function(elementParam,
name,
observer,
useCapture)

Parameters

elementParam{DOMElement || String}
name{String}
observer{function}
useCapture{Boolean}

stopObservingElement

stopObservingElement: function(elementParam)

Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed.

parameters

elementParam{DOMElement || String}

_removeElementObservers

_removeElementObservers: function(elementObservers)

Parameters

elementObservers{Array(Object)} Array of (element, name, observer, usecapture) objects, taken directly from hashtable

stopObserving

stopObserving: function(elementParam,
name,
observer,
useCapture)

Parameters

elementParam{DOMElement || String}
name{String}
observer{function}
useCapture{Boolean}

Returns

{Boolean} Whether or not the event observer was removed

unloadCache

unloadCache: function()

Cycle through all the element entries in the events cache and call stopObservingElement on each.

OpenLayers. Events

Summary
{Array(String)} supported events
{Object} Hashtable of Array(Function): events listener functions
{Object} the code object issuing application events
{DOMElement} the DOM element receiving browser events
{Array(String)} list of support application events
{Function} bound event handler attached to elements
Construct an OpenLayers.Events object.
Remove all listeners for a given event type.
Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position.

Constants

BROWSER_EVENTS

{Array(String)} supported events

Properties

listeners

{Object} Hashtable of Array(Function): events listener functions

object

{Object} the code object issuing application events

element

{DOMElement} the DOM element receiving browser events

eventTypes

{Array(String)} list of support application events

eventHandler

{Function} bound event handler attached to elements

Functions

OpenLayers. Events

Construct an OpenLayers.Events object.

Parameters

object{Object} The js object to which this Events object is being
added element{DOMElement} A dom element to respond to browser events
eventTypes{Array(String)} Array of custom application events
fallThrough{Boolean} Allow events to fall through after these have been handled?

attachToElement

attachToElement: function (element)

Parameters

element{HTMLDOMElement} a DOM element to attach browser events to

remove

remove: function(type)

Remove all listeners for a given event type.  If type is not registered, does nothing.

Parameters

type{String}

handleBrowserEvent

handleBrowserEvent: function (evt)

Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position.

Parameters

evt{Event}

getMousePosition

getMousePosition: function (evt)

Parameters

evt{Event}

Returns {OpenLayers.Pixel} The current xy coordinate of the mouse, adjusted for offsets

OpenLayers. Projection

Class for coordinate transformations between coordinate systems.  Depends on the proj4js library.  If proj4js is not available, then this is just an empty stub.

Summary
This class offers several methods for interacting with a wrapped pro4js projection object.

Functions

OpenLayers. Projection

This class offers several methods for interacting with a wrapped pro4js projection object.

Parameters

options{Object} An optional object with properties to set on the format

Returns

An instance of OpenLayers.Projection

OpenLayers.Tile

This is a class designed to designate a single tile, however it is explicitly designed to do relatively little.  Tiles store information about themselves -- such as the URL that they are related to, and their size - but do not add themselves to the layer div automatically, for example.  Create a new tile with the OpenLayers.Tile constructor, or a subclass.

TBD 3.0remove reference to url in above paragraph
Summary
{Array(String)} Supported application event types
{String} null
{OpenLayers.Layer} layer the tile is attached to
{String} url of the request.
{OpenLayers.Pixel} Top Left pixel of the tile
{Boolean} Is the tile loading?
Constructor for a new OpenLayers.Tile instance.
Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn.
Reposition the tile.
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine.

Constants

EVENT_TYPES

{Array(String)} Supported application event types

Properties

id

{String} null

layer

{OpenLayers.Layer} layer the tile is attached to

url

{String} url of the request.

TBD 3.0 Deprecated.  The base tile class does not need an url.  This should be handled in subclasses.  Does not belong here.

size

position

{OpenLayers.Pixel} Top Left pixel of the tile

isLoading

{Boolean} Is the tile loading?

Functions

OpenLayers.Tile

Constructor for a new OpenLayers.Tile instance.

Parameters

layer{OpenLayers.Layer} layer that the tile will go in.
position{OpenLayers.Pixel}
bounds{OpenLayers.Bounds}
url{<String>}
size{OpenLayers.Size}

draw

draw: function()

Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn.

Returns

{Boolean} Whether or not the tile should actually be drawn.  Note that this is not really the best way of doing things, but such is the way the code has been developed.  Subclasses call this and depend on the return to know if they should draw or not.

moveTo

moveTo: function (bounds,
position,
redraw)

Reposition the tile.

Parameters

bounds{OpenLayers.Bounds}
position{OpenLayers.Pixel}
redraw{Boolean} Call draw method on tile after moving.  Default is true

clear

clear: function()

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

getBoundsFromBaseLayer

getBoundsFromBaseLayer: function(position)

Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine.

Parameters

position{OpenLayers.Pixel}

Returns

bounds{OpenLayers.Bounds}

OpenLayers. Control. OverviewMap

Create an overview map to display the extent of your main map and provide additional navigation control.  Create a new overview map with the OpenLayers.Control.OverviewMap constructor.

Inerits from

Summary
{String} For div.id
{DOMElement} The DOM element that contains the overview map
Create a new overview map
Render the control in the browser.
Handle browser events
Handle browser events
Handle browser events
Handle browser events
Handle browser events
Handle browser events
Unhide the control.
Hide all the contents of the control, shrink the size, add the maximize icon
Hide/Show the toggle depending on whether the control is minimized
Update the overview map after layers move.
Determines if the overview map is suitable given the extent and resolution of the main map.
Construct the map that this control contains
Updates the extent rectangle position and size to match the map extent
Updates the map extent to match the extent rectangle position and size
Get extent rectangle pixel bounds
Set extent rectangle pixel bounds.
Get the rect bounds from the map bounds.
Get the map bounds from the rect bounds.
Get a map location from a pixel location
Get a pixel location from a map location

Properties

id

{String} For div.id

element

{DOMElement} The DOM element that contains the overview map

Functions

OpenLayers. Control. OverviewMap

Create a new overview map

Parameters

object{Object} Properties of this object will be set on the overview map object.  Note, to set options on the map object contained in this control, set <mapOptions> as one of the options properties.

draw

draw: function()

Render the control in the browser.

baseLayerDraw

baseLayerDraw: function()
Draw the base layercalled if unable to complete in the initial draw

rectMouseOut

rectMouseOut: function (evt)

Handle browser events

Parameters

evt{OpenLayers.Event} evt

rectMouseDown

rectMouseDown: function (evt)

Handle browser events

Parameters

evt{OpenLayers.Event} evt

rectMouseMove

rectMouseMove: function(evt)

Handle browser events

Parameters

evt{OpenLayers.Event} evt

rectMouseUp

rectMouseUp: function(evt)

Handle browser events

Parameters

evt{OpenLayers.Event} evt

rectDblClick

rectDblClick: function(evt)

Handle browser events

Parameters

evt{OpenLayers.Event} evt

mapDivClick

mapDivClick: function(evt)

Handle browser events

Parameters

evt{OpenLayers.Event} evt

maximizeControl

maximizeControl: function(e)

Unhide the control.  Called when the control is in the map viewport.

Parameters

e{OpenLayers.Event}

minimizeControl

minimizeControl: function(e)

Hide all the contents of the control, shrink the size, add the maximize icon

Parameters

e{OpenLayers.Event}

showToggle

showToggle: function(minimize)

Hide/Show the toggle depending on whether the control is minimized

Parameters

minimize{Boolean}

update

update: function()

Update the overview map after layers move.

isSuitableOverview

isSuitableOverview: function()

Determines if the overview map is suitable given the extent and resolution of the main map.

createMap

createMap: function()

Construct the map that this control contains

updateRectToMap

updateRectToMap: function()

Updates the extent rectangle position and size to match the map extent

updateMapToRect

updateMapToRect: function()

Updates the map extent to match the extent rectangle position and size

getRectPxBounds

getRectPxBounds: function()

Get extent rectangle pixel bounds

Returns

{OpenLayers.Bounds} A bounds which is the extent rectangle’s pixel bounds (relative to the parent element)

setRectPxBounds

setRectPxBounds: function(pxBounds)

Set extent rectangle pixel bounds.

Parameters

pxBounds{OpenLayers.Bounds}

getRectBoundsFromMapBounds

getRectBoundsFromMapBounds: function(lonLatBounds)

Get the rect bounds from the map bounds.

Parameters

lonLatBounds{OpenLayers.Bounds}

Returns

{OpenLayers.Bounds}A bounds which is the passed-in map lon/lat extent translated into pixel bounds for the overview map

getMapBoundsFromRectBounds

getMapBoundsFromRectBounds: function(pxBounds)

Get the map bounds from the rect bounds.

Parameters

pxBounds{OpenLayers.Bounds}

Returns

{OpenLayers.Bounds} Bounds which is the passed-in overview rect bounds translated into lon/lat bounds for the overview map

getLonLatFromOverviewPx

getLonLatFromOverviewPx: function(overviewMapPx)

Get a map location from a pixel location

Parameters

overviewMapPx{OpenLayers.Pixel}

Returns

{OpenLayers.LonLat} Location which is the passed-in overview map OpenLayers.Pixel, translated into lon/lat by the overview map

getOverviewPxFromLonLat

getOverviewPxFromLonLat: function(lonlat)

Get a pixel location from a map location

Parameters

lonlat{OpenLayers.LonLat}

Returns

{OpenLayers.Pixel} Location which is the passed-in OpenLayers.LonLat, translated into overview map pixels

OpenLayers. Handler

Base class to construct a higher-level handler for event sequences.  All handlers have activate and deactivate methods.  In addition, they have methods named like browser events.  When a handler is activated, any additional methods named like a browser event is registered as a listener for the corresponding event.  When a handler is deactivated, those same methods are unregistered as event listeners.

Handlers also typically have a callbacks object with keys named like the abstracted events or event sequences that they are in charge of handling.  The controls that wrap handlers define the methods that correspond to these abstract events - so instead of listening for individual browser events, they only listen for the abstract events defined by the handler.

Handlers are created by controls, which ultimately have the responsibility of making changes to the the state of the application.  Handlers themselves may make temporary changes, but in general are expected to return the application in the same state that they found it.

Summary
{String}
{Boolean}
{Event} This property references the last event handled by the handler.
Construct a handler.
Check the keyMask on the handler.
Trigger the control’s named callback with the given arguments
register an event on the map
unregister an event from the map
With each registered browser event, the handler sets its own evt property.
Deconstruct the handler.
If set as the <keyMask>, checkModifiers returns false if any key is down.
If set as the <keyMask>, checkModifiers returns false if Shift is down.
If set as the <keyMask>, checkModifiers returns false if Ctrl is down.
If set as the <keyMask>, checkModifiers returns false if Alt is down.

Properties

id

{String}

active

{Boolean}

evt

{Event} This property references the last event handled by the handler.  Note that this property is not part of the stable API.  Use of the evt property should be restricted to controls in the library or other applications that are willing to update with changes to the OpenLayers code.

Functions

OpenLayers. Handler

Construct a handler.

Parameters

control{OpenLayers.Control} The control that initialized this handler.  The control is assumed to have a valid map property; that map is used in the handler’s own setMap method.
callbacks{Object} An object whose properties correspond to abstracted events or sequences of browser events.  The values for these properties are functions defined by the control that get called by the handler.
options{Object} An optional object whose properties will be set on the handler.

setMap

setMap: function (map)

checkModifiers

checkModifiers: function (evt)

Check the keyMask on the handler.  If no <keyMask> is set, this always returns true.  If a <keyMask> is set and it matches the combination of keys down on an event, this returns true.

Returns

{Boolean} The keyMask matches the keys down on an event.

callback

callback: function (name,
args)

Trigger the control’s named callback with the given arguments

Parameters

name{String} The key for the callback that is one of the properties of the handler’s callbacks object.
args{Array(*)} An array of arguments (any type) with which to call the callback (defined by the control).

register

register: function (name,
method)

register an event on the map

unregister

unregister: function (name,
method)

unregister an event from the map

setEvent

setEvent: function(evt)

With each registered browser event, the handler sets its own evt property.  This property can be accessed by controls if needed to get more information about the event that the handler is processing.

This allows modifier keys on the event to be checked (alt, shift, and ctrl cannot be checked with the keyboard handler).  For a control to determine which modifier keys are associated with the event that a handler is currently processing, it should access (code)handler.evt.altKey || handler.evt.shiftKey || handler.evt.ctrlKey(end).

Parameters

evt{Event} The browser event.

destroy

destroy: function ()

Deconstruct the handler.

Constants

OpenLayers. Handler. MOD_NONE

If set as the <keyMask>, checkModifiers returns false if any key is down.

OpenLayers. Handler. MOD_SHIFT

If set as the <keyMask>, checkModifiers returns false if Shift is down.

OpenLayers. Handler. MOD_CTRL

If set as the <keyMask>, checkModifiers returns false if Ctrl is down.

OpenLayers. Handler. MOD_ALT

If set as the <keyMask>, checkModifiers returns false if Alt is down.

OpenLayers.Map

Instances of OpenLayers.Map are interactive maps embedded in a web page.  Create a new map with the OpenLayers.Map constructor.

On their own maps do not provide much functionality.  To extend a map it’s necessary to add controls (OpenLayers.Control) and layers (OpenLayers.Layer) to the map.

Summary
{Object} Base z-indexes for different classes of thing
{Array(String)} supported application event types
{String} Unique identifier for the map
{OpenLayers.Size} Size of the main div (this.div)
{HTMLDivElement} The element that represents the map viewport
{OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom)
{HTMLDivElement} The element that contains the layers.
{Array(OpenLayers.Layer)} Ordered list of layers in the map
{Array(OpenLayers.Control)} List of controls associated with the map
{Array(<OpenLayers.Popup>)} List of popups associated with the map
{OpenLayers.LonLat} The current center of the map
{Integer} The current zoom level of the map
{String} Used to store a unique identifier that changes when the map view changes.
Constructor for a new OpenLayers.Map instance.
Function that is called to destroy the map on page unload.
{OpenLayers.Size} A new OpenLayers.Size object with the dimensions of the map div
This function takes care to recenter the layerContainerDiv.
{Integer} 256 Default tile width (unless otherwise specified)
{Integer} 256 Default tile height (unless otherwise specified)

Constants

Z_INDEX_BASE

{Object} Base z-indexes for different classes of thing

EVENT_TYPES

{Array(String)} supported application event types

Properties

id

{String} Unique identifier for the map

size

{OpenLayers.Size} Size of the main div (this.div)

viewPortDiv

{HTMLDivElement} The element that represents the map viewport

layerContainerOrigin

{OpenLayers.LonLat} The lonlat at which the later container was re-initialized (on-zoom)

layerContainerDiv

{HTMLDivElement} The element that contains the layers.

layers

{Array(OpenLayers.Layer)} Ordered list of layers in the map

controls

{Array(OpenLayers.Control)} List of controls associated with the map

popups

{Array(<OpenLayers.Popup>)} List of popups associated with the map

center

{OpenLayers.LonLat} The current center of the map

zoom

{Integer} The current zoom level of the map

viewRequestID

{String} Used to store a unique identifier that changes when the map view changes. viewRequestID should be used when adding data asynchronously to the map: viewRequestID is incremented when you initiate your request (right now during changing of baselayers and changing of zooms).  It is stored here in the map and also in the data that will be coming back asynchronously.  Before displaying this data on request completion, we check that the viewRequestID of the data is still the same as that of the map.  Fix for #480

Functions

OpenLayers.Map

Constructor for a new OpenLayers.Map instance.

Parameters

div{String} Id of an element in your page that will contain the map.
options{Object} Optional object with properties to tag onto the map.

Examples

// create a map with default options in an element with the id "map1"
var map = new OpenLayers.Map("map1");

// create a map with non-default options in an element with id "map2"
var options = {
maxExtent: new OpenLayers.Bounds(-200000, -200000, 200000, 200000),
maxResolution: 156543,
units: 'meters',
projection: "EPSG:41001"
};
var map = new OpenLayers.Map("map2", options);

unloadDestroy

Function that is called to destroy the map on page unload. stored here so that if map is manually destroyed, we can unregister this.

setLayerZIndex

setLayerZIndex: function (layer,
zIdx)

Parameters

layer{OpenLayers.Layer}
zIdx{int}

addControlToMap

addControlToMap: function (control,
px)

Parameters

control{OpenLayers.Control}
px{OpenLayers.Pixel}

getCurrentSize

getCurrentSize: function()

Returns

{OpenLayers.Size} A new OpenLayers.Size object with the dimensions of the map div

calculateBounds

calculateBounds: function(center,
resolution)

Parameters

center{OpenLayers.LonLat} Default is this.getCenter()
resolution{float} Default is this.getResolution()

Returns

{OpenLayers.Bounds} A bounds based on resolution, center, and current mapsize.

centerLayerContainer

centerLayerContainer: function (lonlat)

This function takes care to recenter the layerContainerDiv.

Parameters

lonlat{OpenLayers.LonLat}

isValidZoomLevel

isValidZoomLevel: function(zoomLevel)

Parameters

zoomLevel{Integer}

Returns

{Boolean} Whether or not the zoom level passed in is non-null and within the min/max range of zoom levels.

isValidLonLat

isValidLonLat: function(lonlat)

Parameters

lonlat{OpenLayers.LonLat}

Returns

{Boolean} Whether or not the lonlat passed in is non-null and within the maxExtent bounds

Constants

TILE_WIDTH

{Integer} 256 Default tile width (unless otherwise specified)

TILE_HEIGHT

{Integer} 256 Default tile height (unless otherwise specified)

OpenLayers. Marker

Instances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon.

Markers are generally added to a special layer called OpenLayers.Layer.Markers.

Example

var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);

var size = new OpenLayers.Size(10,17);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset);
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));

Note that if you pass an icon into the Marker constructor, it will take that icon and use it.  This means that you should not share icons between markers -- you use them once, but you should clone() for any additional markers using that same icon.

Summary
{OpenLayers.Icon} The icon used by this marker.
{OpenLayers.LonLat} location of object
{OpenLayers.Events} the event handler.
{OpenLayers.Map} the map this marker is attached to
Calls draw on the icon, and returns that output.
Move the marker to the new location.
{Boolean} Whether or not the marker is currently visible on screen.
Englarges the markers icon by the specified ratio.
Change the opacity of the marker by changin the opacity of its icon
Hide or show the icon
Creates a default OpenLayers.Icon.

Properties

icon

{OpenLayers.Icon} The icon used by this marker.

lonlat

{OpenLayers.LonLat} location of object

events

{OpenLayers.Events} the event handler.

map

{OpenLayers.Map} the map this marker is attached to

Functions

OpenLayers. Marker

Paraemeters

icon{OpenLayers.Icon} the icon for this marker
lonlat{OpenLayers.LonLat} the position of this marker

draw

draw: function(px)

Calls draw on the icon, and returns that output.

Parameters

px{OpenLayers.Pixel}

Returns

{DOMElement} A new DOM Image with this marker’s icon set at the location passed-in

moveTo

moveTo: function (px)

Move the marker to the new location.

Parameters

px{OpenLayers.Pixel} the pixel position to move to

onScreen

onScreen:function()

Returns

{Boolean} Whether or not the marker is currently visible on screen.

inflate

inflate: function(inflate)

Englarges the markers icon by the specified ratio.

Parameters

inflate{float} the ratio to enlarge the marker by (passing 2 will double the size).

setOpacity

setOpacity: function(opacity)

Change the opacity of the marker by changin the opacity of its icon

Parameters

opacity{float} Specified as fraction (0.4, etc)

display

display: function(display)

Hide or show the icon

display{Boolean}

defaultIcon

OpenLayers.Marker.defaultIcon = function()

Creates a default OpenLayers.Icon.

Returns

{OpenLayers.Icon} A default OpenLayers.Icon to use for a marker

OpenLayers. Tile. Image

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

Inherits from

Summary
{String} The URL of the image being requested.
{DOMElement} The div element which wraps the image.
{DOMElement} The image element is appended to the frame.
Constructor for a new OpenLayers.Tile.Image instance.
Check that a tile should be drawn, and draw it.
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
Creates the imgDiv property on the tile.
Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime.

Properties

url

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

imgDiv

{DOMElement} The div element which wraps the image.

frame

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

Functions

OpenLayers. Tile. Image

Constructor for a new OpenLayers.Tile.Image instance.

Parameters

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

draw

draw:function()

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

Returns

{Boolean} Always returns true.

clear

clear: function()

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

initImgDiv

initImgDiv: function()

Creates the imgDiv property on the tile.

checkImgURL

checkImgURL: function ()

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

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

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

OpenLayers. Handler. Click

A handler for mouse clicks.  The intention of this handler is to give controls more flexibility with handling clicks.  Browsers trigger click events twice for a double-click.  In addition, the mousedown, mousemove, mouseup sequence fires a click event.  With this handler, controls can decide whether to ignore clicks associated with a double click.  By setting a <pixelTolerance>, controls can also ignore clicks that include a drag.  Create a new instance with the OpenLayers.Handler.Click constructor.

Inherits from

Summary
{Number} The id of the timeout waiting to clear the <delayedEvent>.
{OpenLayers.Pixel} The pixel location of the last mousedown.
Create a new click handler.
Handle mousedown.
Handle dblclick.
Handle click.
Determine whether the event is within the optional pixel tolerance.
Clear the timer and set timerId to null.
Sets timerId to null.

Properties

timerId

{Number} The id of the timeout waiting to clear the <delayedEvent>.

down

{OpenLayers.Pixel} The pixel location of the last mousedown.

Functions

OpenLayers. Handler. Click

Create a new click handler.

Parameters

control{OpenLayers.Control} The control that is making use of this handler.  If a handler is being used without a control, the handler’s setMap method must be overridden to deal properly with the map.
callbacks{Object} An object with keys corresponding to callbacks that will be called by the handler.  The callbacks should expect to recieve a single argument, the click event.  Callbacks for ‘click’ and ‘dblclick’ are supported.
options{Object} Optional object whose properties will be set on the handler.

mousedown

Handle mousedown.  Only registered as a listener if pixelTolerance is a non-zero value at construction.

Returns

{Boolean} Continue propagating this event.

dblclick

dblclick: function(evt)

Handle dblclick.  For a dblclick, we get two clicks in some browsers (FF) and one in others (IE).  So we need to always register for dblclick to properly handle single clicks.

Returns

{Boolean} Continue propagating this event.

click

click: function(evt)

Handle click.

Returns

{Boolean} Continue propagating this event.

passesTolerance

passesTolerance: function(evt)

Determine whether the event is within the optional pixel tolerance.  Note that the pixel tolerance check only works if mousedown events get to the listeners registered here.  If they are stopped by other elements, the <pixelTolerance> will have no effect here (this method will always return true).

Returns

{Boolean} The click is within the pixel tolerance (if specified).

clearTimer

clearTimer: function()

Clear the timer and set timerId to null.

delayedCall

delayedCall: function(evt)

Sets timerId to null.  And optionally triggers the click callback if evt is set.

OpenLayers. Handler.Drag

The drag handler is used to deal with sequences of browser events related to dragging.  The handler is used by controls that want to know when a drag sequence begins, when a drag is happening, and when it has finished.

Controls that use the drag handler typically construct it with callbacks for ‘down’, ‘move’, and ‘done’.  Callbacks for these keys are called when the drag begins, with each move, and when the drag is done.  In addition, controls can have callbacks keyed to ‘up’ and ‘out’ if they care to differentiate between the types of events that correspond with the end of a drag sequence.

Create a new drag handler with the OpenLayers.Handler.Drag constructor.

Inherits from

Summary
{Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting.
{Boolean}
{OpenLayers.Pixel} The last pixel location of the drag.
{OpenLayers.Pixel} The first pixel location of the drag.
{Function}
Returns OpenLayers.Handler.Drag
This method is called during the handling of the mouse down event.
This method is called during the handling of the mouse move event.
This method is called during the handling of the mouse up event.
This method is called during the handling of the mouse out event.
Handle mousedown events
Handle mousemove events
Handle mouseup events
Handle mouseout events
The drag handler captures the click event.
Activate the handler.
Deactivate the handler.

Properties

started

{Boolean} When a mousedown event is received, we want to record it, but not set ‘dragging’ until the mouse moves after starting.

dragging

{Boolean}

last

{OpenLayers.Pixel} The last pixel location of the drag.

start

{OpenLayers.Pixel} The first pixel location of the drag.

oldOnselectstart

{Function}

Functions

OpenLayers. Handler.Drag

Returns OpenLayers.Handler.Drag

Parameters

control{OpenLayers.Control} The control that is making use of this handler.  If a handler is being used without a control, the handlers setMap method must be overridden to deal properly with the map.
callbacks{Object} An object containing a single function to be called when the drag operation is finished.  The callback should expect to recieve a single argument, the pixel location of the event.  Callbacks for ‘move’ and ‘done’ are supported.  You can also speficy callbacks for ‘down’, ‘up’, and ‘out’ to respond to those events.
options{Object}

down

down: function(evt)

This method is called during the handling of the mouse down event.  Subclasses can do their own processing here.

Parameters

evt{Event} The mouse down event

move

move: function(evt)

This method is called during the handling of the mouse move event.  Subclasses can do their own processing here.

Parameters

evt{Event} The mouse move event

up

up: function(evt)

This method is called during the handling of the mouse up event.  Subclasses can do their own processing here.

Parameters

evt{Event} The mouse up event

out

out: function(evt)

This method is called during the handling of the mouse out event.  Subclasses can do their own processing here.

Parameters

evt{Event} The mouse out event

mousedown

mousedown: function (evt)

Handle mousedown events

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

mousemove

mousemove: function (evt)

Handle mousemove events

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

mouseup

mouseup: function (evt)

Handle mouseup events

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

mouseout

mouseout: function (evt)

Handle mouseout events

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

click

click: function (evt)

The drag handler captures the click event.  If something else registers for clicks on the same element, its listener will not be called after a drag.

Parameters

evt{Event}

Returns

{Boolean} Let the event propagate.

activate

activate: function()

Activate the handler.

Returns

{Boolean} The handler was successfully activated.

deactivate

deactivate: function()

Deactivate the handler.

Returns

{Boolean} The handler was successfully deactivated.

OpenLayers. Handler. MouseWheel

Handler for wheel up/down events.

Inherits from

Summary
{function}
{OpenLayers.Pixel} mousePosition is necessary because evt.clientX/Y is buggy in Moz on wheel events, so we cache and use the value from the last mousemove.
Catch the wheel event and handle it xbrowserly
Update the stored mousePosition on every move.

Properties

wheelListener

{function}

mousePosition

{OpenLayers.Pixel} mousePosition is necessary because evt.clientX/Y is buggy in Moz on wheel events, so we cache and use the value from the last mousemove.

Functions

OpenLayers. Handler. MouseWheel

Parameters

control{OpenLayers.Control}
callbacks{Object} An object containing a single function to be called when the drag operation is finished.  The callback should expect to recieve a single argument, the point geometry.
options{Object}

destroy

destroy: function()

onWheelEvent

onWheelEvent: function(e)

Catch the wheel event and handle it xbrowserly

Parameters

e{Event}

mousemove

mousemove: function (evt)

Update the stored mousePosition on every move.

Parameters

evt{Event} The browser event

Returns

{Boolean} Allow event propagation

activate

activate: function (evt)

deactivate

deactivate: function (evt)

OpenLayers. Layer

Summary
{Array(String)} Supported application event types
{Boolean} The layer’s images have an alpha channel.
{Boolean} The current map resolution is within the layer’s min/max range.
{OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter.
{Object} An optional object whose properties will be set on the layer.
Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own.
Set the map property for the layer.
{Boolean} The layer is displayable at the current map’s current resolution.
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.
Calculates the max extent which includes all of the data for the layer.
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.

Constants

EVENT_TYPES

{Array(String)} Supported application event types

Properties

alpha

{Boolean} The layer’s images have an alpha channel.  Default is false.

inRange

{Boolean} The current map resolution is within the layer’s min/max range.  This is set in <OpenLayers.Map.setCenter> whenever the zoom changes.

imageOffset

{OpenLayers.Pixel} For layers with a gutter, the image offset represents displacement due to the gutter.

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.

Functions

OpenLayers. Layer

Parameters

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

destroy

destroy: function(setNewBaseLayer)

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.

clone

clone: function (obj)

Parameters

obj{OpenLayers.Layer} The layer to be cloned

Returns

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

moveTo

moveTo:function(bounds,
zoomChanged,
dragging)

Parameters

bound{OpenLayers.Bounds}
zoomChanged{Boolean} Tells when zoom has changed, as layers have to do some init work in that case.
dragging{Boolean}

setMap

setMap: function(map)

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{OpenLayers.Map}

calculateInRange

calculateInRange: function()

Returns

{Boolean} The layer is displayable at the current map’s current resolution.

initResolutions

initResolutions: function()

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

getDataExtent

getDataExtent: function ()

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

Returns

{OpenLayers.Bounds}

setZIndex

setZIndex: function (zIndex)

Parameters

zIndex{Integer}

adjustBounds

adjustBounds: function (bounds)

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{OpenLayers.Bounds}

OpenLayers. Marker.Box

Inherits from

Summary
{DOMElement}
Allow the user to change the box’s color and border width
{Boolean} Whether or not the marker is currently visible on screen.
Hide or show the icon

Properties

div

{DOMElement}

Functions

OpenLayers. Marker.Box

Parameters

bounds{OpenLayers.Bounds}
borderColor{String}
borderWidth{int}

destroy

destroy: function()

setBorder

setBorder: function (color,
width)

Allow the user to change the box’s color and border width

Parameters

color{String} Default is “red”
width{int} Default is 2

draw

draw: function(px,
sz)

Parameters

px{OpenLayers.Pixel}
sz{OpenLayers.Size}

Returns

{DOMElement} A new DOM Image with this marker´s icon set at the location passed-in

onScreen

onScreen:function()

Rreturn

{Boolean} Whether or not the marker is currently visible on screen.

display

display: function(display)

Hide or show the icon

Parameters

display{Boolean}

OpenLayers. Control. DragPan

DragPan control.

Inherits from

Summary
{OpenLayers.Control.TYPES}
{Boolean} The map moved.
Creates a Drag handler, using <OpenLayers.Control.PanMap.panMap> and <OpenLayers.Control.PanMap.panMapDone> as callbacks.
Finish the panning operation.

Properties

type

{OpenLayers.Control.TYPES}

panned

{Boolean} The map moved.

Functions

draw

draw: function()

Creates a Drag handler, using <OpenLayers.Control.PanMap.panMap> and <OpenLayers.Control.PanMap.panMapDone> as callbacks.

panMap

panMap: function(xy)

Parameters

xy{OpenLayers.Pixel} Pixel of the mouse position

panMapDone

panMapDone: function(xy)

Finish the panning operation.  Only call setCenter (through panMap) if the map has actually been moved.

Parameters

xy{OpenLayers.Pixel} Pixel of the mouse position

OpenLayers. Handler.Box

Handler for dragging a rectangle across the map.  Box is displayed on mouse down, moves on mouse move, and is finished on mouse up.

Inherits from

Properties

Functions

OpenLayers. Handler.Box

Parameters

control{OpenLayers.Control}
callbacks{Object} An object containing a single function to be called when the drag operation is finished.  The callback should expect to recieve a single argument, the point geometry.
options{Object}

setMap

setMap: function (map)

startBox

startBox: function (xy)

Parameters

evt{Event}

moveBox

moveBox: function (xy)

endBox

endBox: function(end)

removeBox

removeBox: function()

Remove the zoombox from the screen and nullify our reference to it.

activate

activate: function ()

deactivate

deactivate: function ()

OpenLayers. Layer. HTTPRequest

Inherits from

Summary
{Float} Used to hash URL param strings for multi-WMS server selection.
{Array(String) or String} This is either an array of url strings or a single url string.
{Object} Hashtable of key/value parameters
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.
Combine url with layer’s params and these newParams.

Constants

URL_HASH_FACTOR

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

Properties

url

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

params

{Object} Hashtable of key/value parameters

Functions

OpenLayers. Layer. HTTPRequest

Parameters

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

selectUrl

selectUrl: function(paramString,
urls)

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.

getFullRequestString

getFullRequestString:function(newParams,
altUrl)

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}

OpenLayers. Layer. Markers

Inherits from

Summary
Array({OpenLayers.Marker}) internal marker list
{Boolean} internal state of drawing.
Create a Markers layer.
This method removes all markers from a layer.
Calculate the pixel location for the marker, create it, and add it to the layer’s div

Properties

markers

Array({OpenLayers.Marker}) internal marker list

drawn

{Boolean} internal state of drawing.  This is a workaround for the fact that the map does not call moveTo with a zoomChanged when the map is first starting up.  This lets us catch the case where we have never drawn the layer, and draw it even if the zoom hasn’t changed.

Functions

OpenLayers. Layer. Markers

Create a Markers layer.

Parameters

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

moveTo

moveTo:function(bounds,
zoomChanged,
dragging)

Parameters

bounds{OpenLayers.Bounds}
zoomChanged{Boolean}
dragging{Boolean}

clearMarkers

clearMarkers: function()

This method removes all markers from a layer.  The markers are not destroyed by this function, but are removed from the list of markers.

drawMarker

drawMarker: function(marker)

Calculate the pixel location for the marker, create it, and add it to the layer’s div

Parameters

marker{OpenLayers.Marker}

OpenLayers. Control. ZoomBox

Inherits from

Summary
{OpenLayers.Control.TYPE}

Properties

type

{OpenLayers.Control.TYPE}

Functions

draw

draw: function()

zoomBox

zoomBox: function (position)

Parameters

position{OpenLayers.Bounds} or {OpenLayers.Pixel}

OpenLayers. Layer.Grid

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

Inherits from

Summary
{Array(Array(OpenLayers.Tile))} This is an array of rows, each row is an array of tiles.
Create a new grid layer
Go through and remove all tiles from the grid, calling destroy() on each of them to kill circular references
This function is called whenever the map is moved.
Deprecated.
Starts at the top right corner of the grid and proceeds in a spiral towards the center, adding tiles one at a time to the beginning of a queue.
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.
This function takes a tile as input and removes the tile hooks that were added in addTileMonitoringHooks()
Shifty grid work
Shift grid work in the other dimension
When the size of the map or the buffer changes, we may need to remove some excess rows and columns.
For singleTile layers, this will replace the tile with the a new one with updated tileSize and extent.

Properties

grid

{Array(Array(OpenLayers.Tile))} This is an array of rows, each row is an array of tiles.

Functions

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

clearGrid

clearGrid:function()

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

moveTo

moveTo:function(bounds,
zoomChanged,
dragging)

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{OpenLayers.Bounds}
zoomChanged{Boolean}
dragging{Boolean}

getGridBounds

getGridBounds: function()

Deprecated.  This function will be removed in 3.0.  Please use getTilesBounds() instead.

Returns

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

initSingleTile

initSingleTile: function(bounds)

Parameters

bounds{OpenLayers.Bounds}

initGriddedTiles

initGriddedTiles:function(bounds)

Parameters

bounds{OpenLayers.Bounds}

spiralTileLoad

spiralTileLoad: function()

Starts at the top right corner of the grid and proceeds in a spiral towards the center, adding tiles one at a time to the beginning of a queue.

Once all the grid’s tiles have been added to the queue, we go back and iterate through the queue (thus reversing the spiral order from outside-in to inside-out), calling draw() on each tile.

addTileMonitoringHooks

addTileMonitoringHooks: function(tile)

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{OpenLayers.Tile}

removeTileMonitoringHooks

removeTileMonitoringHooks: function(tile)

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

Parameters

tile{OpenLayers.Tile}

moveGriddedTiles

moveGriddedTiles: function(bounds)

Parameters

bounds{OpenLayers.Bounds}

shiftRow

shiftRow:function(prepend)

Shifty grid work

Parameters

prepend{Boolean} if true, prepend to beginning. if false, then append to end

shiftColumn

shiftColumn: function(prepend)

Shift grid work in the other dimension

Parameters

prepend{Boolean} if true, prepend to beginning. if false, then append to end

removeExcessTiles

removeExcessTiles: function(rows,
columns)

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.
colums{Integer} Maximum number of columns we want our grid to have.

onMapResize

onMapResize: function()

For singleTile layers, this will replace the tile with the a new one with updated tileSize and extent.

OpenLayers. Control. Navigation

The navigation control handles map browsing with mouse events (dragging, double-clicking, and scrolling the wheel).  Create a new navigation control with the OpenLayers.Control.Navigation control.

Note that this control is added to the map by default (if no controls array is sent in the options object to the OpenLayers.Map constructor).

Inherits

Properties

Functions

OpenLayers. Control. Navigation

Create a new navigation control

Parameters

options{Object} An optional object whose properties will be set on the control

activate

activate: function()

deactivate

deactivate: function()

draw

draw: function()

defaultDblClick

defaultDblClick: function (evt)

Parameters

evt{Event}

wheelChange

wheelChange: function(evt,
deltaZ)

Parameters

evt{Event}

wheelUp

wheelUp: function(evt)

User spun scroll wheel up

Parameters

evt{Event}

wheelDown

wheelDown: function(evt)

User spun scroll wheel down

Parameters

evt{Event}

OpenLayers. Layer. MapGuide

Instances of OpenLayers.Layer.MapGuide are used to display data from a MapGuide OS instance.

Inherits from

Summary
{Object} Hashtable of default parameter key/value pairs

Constants

DEFAULT_PARAMS

{Object} Hashtable of default parameter key/value pairs

Functions

initGriddedTiles

initGriddedTiles:function(bounds)

Parameters

bounds{OpenLayers.Bounds}

OpenLayers. Layer. MapServer

Instances of OpenLayers.Layer.MapServer are used to display data from a MapServer CGI instance.

Inherits from

Summary
{Object} Hashtable of default parameter key/value pairs
Create a new MapServer layer object
Create a clone of this layer
Creates a tile, initializes it, and adds it to the layer div.
Return a query string for this layer
combine the layer’s url with its params and these newParams.

Constants

DEFAULT_PARAMS

{Object} Hashtable of default parameter key/value pairs

Functions

OpenLayers. Layer. MapServer

Create a new MapServer layer object

Parameters

name{String} A name for the layer
url{String} Base url for the MapServer CGI (e.g.  http://www2.dmsolutions.ca/cgi-bin/mapserv)
params{Object} An object with key/value pairs representing the GetMap query string parameters and parameter values.
options{Ojbect} Hashtable of extra options to tag onto the layer

clone

clone: function (obj)

Create a clone of this layer

Returns

{OpenLayers.Layer.MapServer} An exact clone of this layer

addTile

addTile:function(bounds,
position)

Creates a tile, initializes it, and adds it to the layer div.

Parameters

bounds{OpenLayers.Bounds}

Returns

{OpenLayers.Tile.Image} The added OpenLayers.Tile.Image

getURL

getURL: function (bounds)

Return a query string for this layer

Parameters

bounds{OpenLayers.Bounds} A bounds representing the bbox for the request

Returns

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

getFullRequestString

getFullRequestString:function(newParams,
altUrl)

combine the layer’s url with its params and these newParams.

Parameter

newParams{Object} New parameters that should be added to the request string.
altUrl{String} (optional) Replace the URL in the full request string with the provided URL.

Returns

{String} A string with the layer’s url and parameters embedded in it.

OpenLayers. Layer.WMS

Instances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services.  Create a new WMS layer with the OpenLayers.Layer.WMS constructor.

Inherits from

Summary
{Object} Hashtable of default parameter key/value pairs
Deprecated.
Create a new WMS layer object
Destroy this layer
Create a clone of this layer
Return a GetMap query string for this layer
addTile creates a tile, initializes it, and adds it to the layer div.
Combine the layer’s url with its params and these newParams.

Constants

DEFAULT_PARAMS

{Object} Hashtable of default parameter key/value pairs

Properties

reproject

Deprecated.  See http://trac.openlayers.org/wiki/SpatialMercator for information on the replacement for this functionality.  {Boolean} Try to reproject this layer if its coordinate reference system is different than that of the base layer.  Default is true.  Set this in the layer options.  Should be set to false in most cases.

Functions

OpenLayers. Layer.WMS

Create a new WMS layer object

Example

var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
{layers: "modis,global_mosaic"});

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{Ojbect} Hashtable of extra options to tag onto the layer

destroy

destroy: function()

Destroy this layer

clone

clone: function (obj)

Create a clone of this layer

Returns

{OpenLayers.Layer.WMS} An exact clone of this layer

getURL

getURL: function (bounds)

Return a GetMap query string for this layer

Parameters

bounds{OpenLayers.Bounds} A bounds representing the bbox for the request.

Returns

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

addTile

addTile:function(bounds,
position)

addTile creates a tile, initializes it, and adds it to the layer div.

Parameters

bounds{OpenLayers.Bounds}

Returns

{OpenLayers.Tile.Image} The added OpenLayers.Tile.Image

getFullRequestString

getFullRequestString:function(newParams)

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}

Returns

{String}

_getScriptLocation: function ()
Return the path to this script.
OpenLayers.Util.getElement = function()
This is the old $() from prototype
OpenLayers.Util.removeItem = function(array,
item)
Remove an object from an array.
OpenLayers.Util.clearArray = function(array)
Deprecated.
OpenLayers.Util.indexOf = function(array,
obj)
Seems to exist already in FF, but not in MOZ.
OpenLayers.Util.modifyDOMElement = function(element,
id,
px,
sz,
position,
border,
overflow,
opacity)
Modifies many properties of a DOM element all at once.
OpenLayers.Util.createImage = function(id,
px,
sz,
imgURL,
position,
border,
opacity,
delayDisplay)
Creates an img element with specific attribute values.
OpenLayers.Util.setOpacity = function(element,
opacity)
Deprecated.
OpenLayers.Util.onImageLoad = function()
OpenLayers.Util.onImageLoadError = function()
OpenLayers.Util.alphaHack = function()
Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer.
OpenLayers.Util.modifyAlphaImageDiv = function(div,
id,
px,
sz,
imgURL,
position,
border,
sizing,
opacity)
OpenLayers.Util.createAlphaImageDiv = function(id,
px,
sz,
imgURL,
position,
border,
sizing,
opacity,
delayDisplay)
OpenLayers.Util.upperCaseObject = function (object)
Creates a new hashtable and copies over all the keys from the passed-in object, but storing them under an uppercased version of the key at which they were stored.
OpenLayers.Util.applyDefaults = function (to,
from)
Takes a hashtable and copies any keys that don’t exist from another hashtable, by analogy with OpenLayers.Util.extend() from Prototype.js.
OpenLayers.Util.getParameterString = function(params)
OpenLayers.Util.getImagesLocation = function()
{String} The fully formatted image location string
OpenLayers.Util.Try = function()
Execute functions until one of them doesn’t throw an error.
OpenLayers.Util.getNodes=function(p,
tagName)
These could/should be made namespace aware?
OpenLayers.Util._getNodes=function(nodes,
tagName)
OpenLayers.Util.getTagText = function (parent,
item,
index)
OpenLayers.Util.getXmlNodeValue = function(node)
OpenLayers.Util.mouseLeft = function (evt,
div)
OpenLayers.Util.rad = function(x)
OpenLayers.Util.distVincenty=function(p1,
p2)
OpenLayers.Util.getParameters = function(url)
Parse the parameters from a URL or from the current page itself into a JavaScript Object.
OpenLayers.Util.getArgs = function(url)
OpenLayers.Util.createUniqueID = function(prefix)
prefix {String} String to prefix unique id.
OpenLayers.Util.getResolutionFromScale = function (scale,
units)
OpenLayers.Util.getScaleFromResolution = function (resolution,
units)
OpenLayers.Util.safeStopPropagation = function(evt)
Deprecated.
OpenLayers.Util.isEquivalentUrl = function(url1,
url2,
options)
Test two URLs for equivalence.
OpenLayers.Util.createUrlObject = function(url,
options)
OpenLayers.Util.removeTail = function(url)
Takes a url and removes everything after the ?
OpenLayers.Util.getBrowserName = function()
{String} A string which specifies which is the current browser in which we are running.
OpenLayers.Class = function()
Base class used to construct all other classes.
toString:function()
Return the string representation of a size object
clone:function()
Create a cloned instance of this bounds.
equals:function(bounds)
Test a two bounds for equivalence.
OpenLayers.Bounds.oppositeQuadrant = function(quadrant)
Get the opposite quadrant for a given quadrant string.
toString:function()
Return a readable string version of the lonlat
OpenLayers.LonLat.fromString = function(str)
Alternative constructor that builds a new OpenLayers.LonLat from a parameter string
Create a new map location.
toString:function()
Cast this object into a string
OpenLayers.loadURL = function(uri,
params,
caller,
onComplete,
onFailure)
Background load a document.
OpenLayers.parseXMLString = function(text)
Parse XML into a doc structure
emptyFunction: function ()
getTransport: function()
{Object} Transport mechanism for whichever browser we’re in, or false if none available.
register: function(responderToAdd)
dispatch: function(callback,
request,
transport,
json)
onCreate: function()
onComplete: function()
setOptions: function(options)
responseIsSuccess: function()
{Boolean}
responseIsFailure: function()
{Boolean}
request: function(url)
setRequestHeaders: function()
onStateChange: function()
header: function(name)
{?}
evalJSON: function()
{?}
evalResponse: function()
{?}
respondToReadyState: function(readyState)
dispatchException: function(exception)
OpenLayers.Ajax.getElementsByTagNameNS = function(parentnode,
nsuri,
nsprefix,
tagname)
OpenLayers.Ajax.serializeXMLToString = function(xmldom)
Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Base class to construct a higher-level handler for event sequences.
destroy: function ()
The destroy method is used to perform any clean up before the control is dereferenced.
setMap: function(map)
Set the map property for the control.
draw: function (px)
The draw method is called when the control is ready to be displayed on the page.
moveTo: function (px)
Sets the left and top style attributes to the passed in pixel coordinates.
activate: function ()
Explicitly activates a control and it’s associated handler if one has been set.
deactivate: function ()
Deactivates a control and it’s associated handler if any.
Instances of this class represent a width/height pair
This class represents a screen coordinate, in x and y coordinates
destroy: function()
Nullify references and remove event listeners to prevent circular references and memory leaks
clone: function()
{OpenLayers.Icon} A fresh copy of the icon.
Creates an icon, which is an image tag in a div.
setSize: function(size)
draw: function(px)
Move the div to the given pixel.
setOpacity: function(opacity)
Change the icon’s opacity
moveTo: function (px)
move icon to passed in px.
display: function(display)
Hide or show the icon
setMap: function(map)
Set the map property for the control.
setCenter: function()
As soon as a baseLayer has been loaded, we center and zoom ...and remove the handler.
configureLayers: function()
As soon as all the layers are loaded, cycle through them and hide or show them.
draw: function(px)
_addButton:function(id,
img,
xy,
sz)
doubleClick: function (evt)
buttonDown: function (evt)
element: function(event)
Cross browser event element detection.
isLeftClick: function(event)
Determine whether event was caused by a left click.
stop: function(event,
allowDefault)
Stops an event from propagating.
findElement: function(event,
tagName)
observe: function(elementParam,
name,
observer,
useCapture)
stopObservingElement: function(elementParam)
Given the id of an element to stop observing, cycle through the element’s cached observers, calling stopObserving on each one, skipping those entries which can no longer be removed.
_removeElementObservers: function(elementObservers)
stopObserving: function(elementParam,
name,
observer,
useCapture)
unloadCache: function()
Cycle through all the element entries in the events cache and call stopObservingElement on each.
attachToElement: function (element)
remove: function(type)
Remove all listeners for a given event type.
handleBrowserEvent: function (evt)
Basically just a wrapper to the triggerEvent() function, but takes care to set a property ‘xy’ on the event with the current mouse position.
getMousePosition: function (evt)
Constructor for a new OpenLayers.Tile instance.
draw: function()
Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn.
moveTo: function (bounds,
position,
redraw)
Reposition the tile.
clear: function()
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
getBoundsFromBaseLayer: function(position)
Take the pixel locations of the corner of the tile, and pass them to the base layer and ask for the location of those pixels, so that displaying tiles over Google works fine.
draw: function()
Render the control in the browser.
baseLayerDraw: function()
rectMouseOut: function (evt)
Handle browser events
rectMouseDown: function (evt)
Handle browser events
rectMouseMove: function(evt)
Handle browser events
rectMouseUp: function(evt)
Handle browser events
rectDblClick: function(evt)
Handle browser events
mapDivClick: function(evt)
Handle browser events
maximizeControl: function(e)
Unhide the control.
minimizeControl: function(e)
Hide all the contents of the control, shrink the size, add the maximize icon
showToggle: function(minimize)
Hide/Show the toggle depending on whether the control is minimized
update: function()
Update the overview map after layers move.
isSuitableOverview: function()
Determines if the overview map is suitable given the extent and resolution of the main map.
createMap: function()
Construct the map that this control contains
updateRectToMap: function()
Updates the extent rectangle position and size to match the map extent
updateMapToRect: function()
Updates the map extent to match the extent rectangle position and size
getRectPxBounds: function()
Get extent rectangle pixel bounds
setRectPxBounds: function(pxBounds)
Set extent rectangle pixel bounds.
getRectBoundsFromMapBounds: function(lonLatBounds)
Get the rect bounds from the map bounds.
getMapBoundsFromRectBounds: function(pxBounds)
Get the map bounds from the rect bounds.
getLonLatFromOverviewPx: function(overviewMapPx)
Get a map location from a pixel location
getOverviewPxFromLonLat: function(lonlat)
Get a pixel location from a map location
setMap: function (map)
checkModifiers: function (evt)
Check the keyMask on the handler.
callback: function (name,
args)
Trigger the control’s named callback with the given arguments
register: function (name,
method)
register an event on the map
unregister: function (name,
method)
unregister an event from the map
setEvent: function(evt)
With each registered browser event, the handler sets its own evt property.
destroy: function ()
Deconstruct the handler.
This class represents a longitude and latitude pair
Controls affect the display or behavior of the map.
setLayerZIndex: function (layer,
zIdx)
addControlToMap: function (control,
px)
getCurrentSize: function()
{OpenLayers.Size} A new OpenLayers.Size object with the dimensions of the map div
calculateBounds: function(center,
resolution)
centerLayerContainer: function (lonlat)
This function takes care to recenter the layerContainerDiv.
isValidZoomLevel: function(zoomLevel)
isValidLonLat: function(lonlat)
The icon represents a graphical icon on the screen.
draw: function(px)
Calls draw on the icon, and returns that output.
moveTo: function (px)
Move the marker to the new location.
onScreen:function()
{Boolean} Whether or not the marker is currently visible on screen.
inflate: function(inflate)
Englarges the markers icon by the specified ratio.
setOpacity: function(opacity)
Change the opacity of the marker by changin the opacity of its icon
display: function(display)
Hide or show the icon
OpenLayers.Marker.defaultIcon = function()
Creates a default OpenLayers.Icon.
Constructor for a new OpenLayers.Tile.Image instance.
draw:function()
Check that a tile should be drawn, and draw it.
clear: function()
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
initImgDiv: function()
Creates the imgDiv property on the tile.
checkImgURL: function ()
Make sure that the image that just loaded is the one this tile is meant to display, since panning/zooming might have changed the tile’s URL in the meantime.
dblclick: function(evt)
Handle dblclick.
click: function(evt)
Handle click.
passesTolerance: function(evt)
Determine whether the event is within the optional pixel tolerance.
clearTimer: function()
Clear the timer and set timerId to null.
{Number} The id of the timeout waiting to clear the delayedEvent.
delayedCall: function(evt)
Sets timerId to null.
down: function(evt)
This method is called during the handling of the mouse down event.
move: function(evt)
This method is called during the handling of the mouse move event.
up: function(evt)
This method is called during the handling of the mouse up event.
out: function(evt)
This method is called during the handling of the mouse out event.
mousedown: function (evt)
Handle mousedown events
mousemove: function (evt)
Handle mousemove events
mouseup: function (evt)
Handle mouseup events
mouseout: function (evt)
Handle mouseout events
click: function (evt)
The drag handler captures the click event.
activate: function()
Activate the handler.
deactivate: function()
Deactivate the handler.
destroy: function()
onWheelEvent: function(e)
Catch the wheel event and handle it xbrowserly
mousemove: function (evt)
Update the stored mousePosition on every move.
activate: function (evt)
deactivate: function (evt)
destroy: function(setNewBaseLayer)
Destroy is a destructor: this is to alleviate cyclic references which the Javascript garbage cleaner can not take care of on its own.
clone: function (obj)
moveTo:function(bounds,
zoomChanged,
dragging)
setMap: function(map)
Set the map property for the layer.
calculateInRange: function()
{Boolean} The layer is displayable at the current map’s current resolution.
initResolutions: function()
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.
getDataExtent: function ()
Calculates the max extent which includes all of the data for the layer.
setZIndex: function (zIndex)
adjustBounds: function (bounds)
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.
Instances of this class represent bounding boxes.
destroy: function()
setBorder: function (color,
width)
Allow the user to change the box’s color and border width
draw: function(px,
sz)
onScreen:function()
{Boolean} Whether or not the marker is currently visible on screen.
display: function(display)
Hide or show the icon
draw: function()
Creates a Drag handler, using OpenLayers.Control.PanMap.panMap and OpenLayers.Control.PanMap.panMapDone as callbacks.
panMap: function(xy)
panMapDone: function(xy)
Finish the panning operation.
The drag handler is used to deal with sequences of browser events related to dragging.
setMap: function (map)
startBox: function (xy)
moveBox: function (xy)
endBox: function(end)
removeBox: function()
Remove the zoombox from the screen and nullify our reference to it.
activate: function ()
deactivate: function ()
selectUrl: function(paramString,
urls)
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.
getFullRequestString:function(newParams,
altUrl)
Combine url with layer’s params and these newParams.
Instances of OpenLayers.Marker are a combination of a OpenLayers.LonLat and an OpenLayers.Icon.
moveTo:function(bounds,
zoomChanged,
dragging)
clearMarkers: function()
This method removes all markers from a layer.
drawMarker: function(marker)
Calculate the pixel location for the marker, create it, and add it to the layer’s div
draw: function()
zoomBox: function (position)
This is a class designed to designate a single tile, however it is explicitly designed to do relatively little.
clearGrid:function()
Go through and remove all tiles from the grid, calling destroy() on each of them to kill circular references
moveTo:function(bounds,
zoomChanged,
dragging)
This function is called whenever the map is moved.
getGridBounds: function()
Deprecated.
initSingleTile: function(bounds)
initGriddedTiles:function(bounds)
spiralTileLoad: function()
Starts at the top right corner of the grid and proceeds in a spiral towards the center, adding tiles one at a time to the beginning of a queue.
addTileMonitoringHooks: function(tile)
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.
removeTileMonitoringHooks: function(tile)
This function takes a tile as input and removes the tile hooks that were added in addTileMonitoringHooks()
moveGriddedTiles: function(bounds)
shiftRow:function(prepend)
Shifty grid work
shiftColumn: function(prepend)
Shift grid work in the other dimension
removeExcessTiles: function(rows,
columns)
When the size of the map or the buffer changes, we may need to remove some excess rows and columns.
onMapResize: function()
For singleTile layers, this will replace the tile with the a new one with updated tileSize and extent.
DragPan control.
Handler for wheel up/down events.
activate: function()
deactivate: function()
draw: function()
defaultDblClick: function (evt)
wheelChange: function(evt,
deltaZ)
wheelUp: function(evt)
User spun scroll wheel up
wheelDown: function(evt)
User spun scroll wheel down
initGriddedTiles:function(bounds)
clone: function (obj)
Create a clone of this layer
addTile:function(bounds,
position)
Creates a tile, initializes it, and adds it to the layer div.
getURL: function (bounds)
Return a query string for this layer
getFullRequestString:function(newParams,
altUrl)
combine the layer’s url with its params and these newParams.
destroy: function()
Destroy this layer
clone: function (obj)
Create a clone of this layer
getURL: function (bounds)
Return a GetMap query string for this layer
addTile:function(bounds,
position)
addTile creates a tile, initializes it, and adds it to the layer div.
getFullRequestString:function(newParams)
Combine the layer’s url with its params and these newParams.
Construct a new bounds object.
{Object}
Create a new overview map
Utility functions for event handling.
Constructor for a new OpenLayers.Map instance.
Create a new click handler.
Returns OpenLayers.Handler.Drag
Create a new grid layer
Create a new navigation control
Base class for layers that use a lattice of tiles.
Create a new MapServer layer object
Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers.
Create a new WMS layer object