# Util

Summary

Util |
Functions and Properties |
getElement | This is the old $() from prototype
isElement | A cross-browser implementation of “e instanceof Element”.
isArray | Tests that the provided object is an array.
removeItem | Remove an object from an array.
clearArray | Deprecated.
indexOf | Seems to exist already in FF, but not in MOZ.
modifyDOMElement | Modifies many properties of a DOM element all at once.
createDiv | Creates a new div and optionally set some standard attributes.
createImage | Creates an img element with specific attribute values.
setOpacity | Deprecated.
onImageLoad | Bound to image load events.
IMAGE_RELOAD_ATTEMPTS | {Integer} How many times should we try to reload an image before giving up?
onImageLoadError |
alphaHackNeeded | {Boolean} true if the png alpha hack is necessary and possible, false otherwise.
alphaHack | Checks whether it’s necessary (and possible) to use the png alpha hack which allows alpha transparency for png images under Internet Explorer.
modifyAlphaImageDiv |
createAlphaImageDiv |
upperCaseObject | 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.
applyDefaults | Takes an object and copies any properties that don’t exist from another properties, by analogy with OpenLayers.Util.extend() from Prototype.js.
getParameterString |
urlAppend | Appends a parameter string to a url.
ImgPath | {String} Default is ‘’.
getImagesLocation | {String} The fully formatted image location string
Try | Execute functions until one of them doesn’t throw an error.
getXmlNodeValue |
mouseLeft |
precision | {Number} The number of significant digits to retain to avoid floating point precision errors.
toFloat | Convenience method to cast an object to a Number, rounded to the desired floating point precision.
rad |
deg |
VincentyConstants | {Object} Constants for Vincenty functions.
distVincenty | Given two objects representing points with geographic coordinates, this calculates the distance between those points on the surface of an ellipsoid.
destinationVincenty | Calculate destination point given start point lat/long (numeric degrees), bearing (numeric degrees) & distance (in m).
getParameters | Parse the parameters from a URL or from the current page itself into a JavaScript Object.
getArgs | Deprecated.
lastSeqID | {Integer} The ever-incrementing count variable.
createUniqueID | Create a unique identifier for this session.
Constants |
INCHES_PER_UNIT | {Object} Constant inches per unit -- borrowed from MapServer mapscale.c derivation of nautical miles from http://en.wikipedia.org/wiki/Nautical_mile Includes the full set of units supported by CS-MAP (http://trac.osgeo.org/csmap/) and PROJ.4 (http://trac.osgeo.org/proj/) The hardcoded table is maintain in a CS-MAP source code module named CSdataU.c The hardcoded table of PROJ.4 units are in pj_units.c.
DOTS_PER_INCH | {Integer} 72 (A sensible default)
Functions |
normalizeScale |
getResolutionFromScale |
getScaleFromResolution |
safeStopPropagation | Deprecated.
pagePosition | Calculates the position of an element on the page | getViewportElement | Returns die viewport element of the document.
isEquivalentUrl | Test two URLs for equivalence.
createUrlObject |
removeTail | Takes a url and removes everything after the ?
Constants |
IS_GECKO | {Boolean} True if the userAgent reports the browser to use the Gecko engine
BROWSER_NAME | {String} A substring of the navigator.userAgent property.
Functions |
getBrowserName | {String} A string which specifies which is the current browser in which we are running.
getRenderedDimensions | Renders the contentHTML offscreen to determine actual dimensions for popup sizing.
getScrollbarWidth | This function has been modified by the OpenLayers from the original version, written by Matthew Eernisse and released under the Apache 2 license here:
getFormattedLonLat | This function will return latitude or longitude value formatted as

### Functions and Properties

### getElement

> OpenLayers.Util.getElement = function()

This is the old $() from prototype

#### Parameters

e | {String or DOMElement or Window} Return: {Array(DOMElement)}

### isElement

> OpenLayers.Util.isElement = function( | o | )

A cross-browser implementation of “e instanceof Element”.

#### Parameters

o | {Object} The object to test.

#### Returns

{Boolean}

### isArray

> OpenLayers.Util.isArray = function( | a | )

Tests that the provided object is an array. This test handles the cross-IFRAME case not caught by “a instanceof Array” and should be used instead.

#### Parameters

a | {Object} the object test.

Returns {Boolean} true if the object is an array.

### 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 | {*}

#### Returns

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

### 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

element | {DOMElement} DOM element to modify.
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

> OpenLayers.Util.createDiv = function( | id,
> | px,
> | sz,
> | imgURL,
> | position,
> | border,
> | overflow,
> | opacity | )

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. Note - zIndex is NOT set on the resulting div.

#### 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.
opacity | {Float} Fractional value (0.0 - 1.0)
delayDisplay | {Boolean} If true waits until the image has been loaded.

#### 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()

Bound to image load events. For all images created with createImage or createAlphaImageDiv, this function will be bound to the load event.

### IMAGE_RELOAD_ATTEMPTS

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

### onImageLoadError

> OpenLayers.Util.onImageLoadError = function()

### alphaHackNeeded

{Boolean} true if the png alpha hack is necessary and possible, false otherwise.

### 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 the png alpha hack is necessary and possible, false otherwise.

### modifyAlphaImageDiv

> OpenLayers.Util.modifyAlphaImageDiv = function( | div,
> | id,
> | px,
> | sz,
> | imgURL,
> | position,
> | border,
> | sizing,
> | opacity | )

#### Parameters

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 | )

#### Parameters

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)
delayDisplay | {Boolean} If true waits until the image has been loaded.

#### 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 an object and copies any properties that don’t exist from another properties, by analogy with OpenLayers.Util.extend() from Prototype.js.

#### Parameters

to | {Object} The destination object.
from | {Object} The source object. Any properties of this object that are undefined in the to object will be set on the to object.

#### Returns

{Object} A reference to the to object. Note that the to argument is modified in place and returned by this function.

### 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).

### urlAppend

> OpenLayers.Util.urlAppend = function( | url,
> | paramStr | )

Appends a parameter string to a url. This function includes the logic for using the appropriate character (none, & or ?) to append to the url before appending the param string.

#### Parameters

url | {String} The url to append to
paramStr | {String} The param string to append

#### Returns

{String} The new url

### 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.

### 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}

### precision

{Number} The number of significant digits to retain to avoid floating point precision errors.

We use 14 as a “safe” default because, although IEEE 754 double floats (standard on most modern operating systems) support up to about 16 significant digits, 14 significant digits are sufficient to represent sub-millimeter accuracy in any coordinate system that anyone is likely to use with OpenLayers.

If DEFAULT_PRECISION is set to 0, the original non-truncating behavior of OpenLayers <2.8 is preserved. Be aware that this will cause problems with certain projections, e.g. spherical Mercator.

### toFloat

> OpenLayers.Util.toFloat = function ( | number,
> | precision | )

Convenience method to cast an object to a Number, rounded to the desired floating point precision.

#### Parameters

number | {Number} The number to cast and round.
precision | {Number} An integer suitable for use with Number.toPrecision(). Defaults to OpenLayers.Util.DEFAULT_PRECISION. If set to 0, no rounding is performed.

#### Returns

{Number} The cast, rounded number.

### rad

> OpenLayers.Util.rad = function( | x | )

#### Parameters

x | {Float}

#### Returns

{Float}

### deg

> OpenLayers.Util.deg = function( | x | )

#### Parameters

x | {Float}

#### Returns

{Float}

### VincentyConstants

{Object} Constants for Vincenty functions.

### distVincenty

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

Given two objects representing points with geographic coordinates, this calculates the distance between those points on the surface of an ellipsoid.

#### Parameters

p1 | {OpenLayers.LonLat} (or any object with both .lat, .lon properties)
p2 | {OpenLayers.LonLat} (or any object with both .lat, .lon properties)

#### Returns

{Float} The distance (in km) between the two input points as measured on an ellipsoid. Note that the input point objects must be in geographic coordinates (decimal degrees) and the return distance is in kilometers.

### destinationVincenty

> OpenLayers.Util.destinationVincenty = function( | lonlat,
> | brng,
> | dist | )

Calculate destination point given start point lat/long (numeric degrees), bearing (numeric degrees) & distance (in m). Adapted from Chris Veness work, see http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html

#### Parameters

lonlat | {OpenLayers.LonLat} (or any object with both .lat, .lon properties) The start point.
brng | {Float} The bearing (degrees).
dist | {Float} The ground distance (meters).

#### Returns

{OpenLayers.LonLat} The destination point.

### 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 url is null or is not supplied, query string is taken from the page location.

#### Returns

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

### getArgs

> OpenLayers.Util.getArgs = function( | url | )

Deprecated. Will 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 | )

Create a unique identifier for this session. Each time this function is called, a counter is incremented. The return will be the optional prefix (defaults to “id_”) appended with the counter value.

#### Parameters

prefix {String} Optionsal string to prefix unique id. 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 derivation of nautical miles from http://en.wikipedia.org/wiki/Nautical_mile Includes the full set of units supported by CS-MAP (http://trac.osgeo.org/csmap/) and PROJ.4 (http://trac.osgeo.org/proj/) The hardcoded table is maintain in a CS-MAP source code module named CSdataU.c The hardcoded table of PROJ.4 units are in pj_units.c.

### DOTS_PER_INCH

{Integer} 72 (A sensible default)

### Functions

### normalizeScale

> OpenLayers.Util.normalizeScale = function ( | scale | )

#### 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. If the given scale is falsey, the returned resolution will be undefined.

### 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}

### pagePosition

> OpenLayers.Util.pagePosition = function( | forElement | )

Calculates the position of an element on the page

### getViewportElement

> OpenLayers.Util.getViewportElement = function()

Returns die viewport element of the document. The viewport element is usually document.documentElement, except in IE,where it is either document.body or document.documentElement, depending on the document’s compatibility mode

### 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

### Constants

### IS_GECKO

{Boolean} True if the userAgent reports the browser to use the Gecko engine

### BROWSER_NAME

{String} A substring of the navigator.userAgent property. Depending on the userAgent property, this will be the empty string or one of the following:

- ”opera” -- Opera
- ”msie” -- Internet Explorer
- ”safari” -- Safari
- ”firefox” -- Firefox
- ”mozilla” -- Mozilla

### Functions

### 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.

### getRenderedDimensions

> OpenLayers.Util.getRenderedDimensions = function( | contentHTML,
> | size,
> | options | )

Renders the contentHTML offscreen to determine actual dimensions for popup sizing. As we need layout to determine dimensions the content is rendered -9999px to the left and absolute to ensure the scrollbars do not flicker

#### Parameters

contentHTML size - {OpenLayers.Size} If either the ‘w’ or ‘h’ properties is specified, we fix that dimension of the div to be measured. This is useful in the case where we have a limit in one dimension and must therefore meaure the flow in the other dimension. options - {Object}

#### Allowed Options

displayClass | {String} Optional parameter. A CSS class name(s) string to provide the CSS context of the rendered content.
containerElement | {DOMElement} Optional parameter. Insert the HTML to this node instead of the body root when calculating dimensions.

#### Returns

{OpenLayers.Size}

### getScrollbarWidth

> OpenLayers.Util.getScrollbarWidth = function()

This function has been modified by the OpenLayers from the original version, written by Matthew Eernisse and released under the Apache 2 license here:

http://www.fleegix.org/articles/2006/05/30/getting-the-scrollbar-width-in-pixels

It has been modified simply to cache its value, since it is physically impossible that this code could ever run in more than one browser at once.

#### Returns

{Integer}

### getFormattedLonLat

> OpenLayers.Util.getFormattedLonLat = function( | coordinate,
> | axis,
> | dmsOption | )

This function will return latitude or longitude value formatted as

#### Parameters

coordinate | {Float} the coordinate value to be formatted
axis | {String} value of either ‘lat’ or ‘lon’ to indicate which axis is to to be formatted (default = lat)
dmsOption | {String} specify the precision of the output can be one of: ‘dms’ show degrees minutes and seconds ‘dm’ show only degrees and minutes ‘d’ show only degrees

#### Returns

{String} the coordinate value formatted as a string

> OpenLayers.Util.getElement = function()

This is the old $() from prototype

> OpenLayers.Util.isElement = function( | o | )

A cross-browser implementation of “e instanceof Element”.

> OpenLayers.Util.isArray = function( | a | )

Tests that the provided object is an array.

> 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.createDiv = function( | id,
> | px,
> | sz,
> | imgURL,
> | position,
> | border,
> | overflow,
> | opacity | )

Creates a new div and optionally set some standard attributes.

> 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()

Bound to image load events.

> 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 an object and copies any properties that don’t exist from another properties, by analogy with OpenLayers.Util.extend() from Prototype.js.

> OpenLayers.Util.getParameterString = function( | params | )

> OpenLayers.Util.urlAppend = function( | url,
> | paramStr | )

Appends a parameter string to a url.

> 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.getXmlNodeValue = function( | node | )

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

> OpenLayers.Util.toFloat = function ( | number,
> | precision | )

Convenience method to cast an object to a Number, rounded to the desired floating point precision.

> OpenLayers.Util.rad = function( | x | )

> OpenLayers.Util.deg = function( | x | )

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

Given two objects representing points with geographic coordinates, this calculates the distance between those points on the surface of an ellipsoid.

> OpenLayers.Util.destinationVincenty = function( | lonlat,
> | brng,
> | dist | )

Calculate destination point given start point lat/long (numeric degrees), bearing (numeric degrees) & distance (in m).

> 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 | )

Deprecated.

> OpenLayers.Util.createUniqueID = function( | prefix | )

Create a unique identifier for this session.

> OpenLayers.Util.normalizeScale = function ( | scale | )

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

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

> OpenLayers.Util.safeStopPropagation = function( | evt | )

Deprecated.

> OpenLayers.Util.pagePosition = function( | forElement | )

Calculates the position of an element on the page

> OpenLayers.Util.getViewportElement = function()

Returns die viewport element of the document.

> 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.Util.getRenderedDimensions = function( | contentHTML,
> | size,
> | options | )

Renders the contentHTML offscreen to determine actual dimensions for popup sizing.

> OpenLayers.Util.getScrollbarWidth = function()

This function has been modified by the OpenLayers from the original version, written by Matthew Eernisse and released under the Apache 2 license here:

> OpenLayers.Util.getFormattedLonLat = function( | coordinate,
> | axis,
> | dmsOption | )

This function will return latitude or longitude value formatted as
This class represents a screen coordinate, in x and y coordinates
Instances of this class represent a width/height pair
This class represents a longitude and latitude pair

> stop: function( | event,
> | allowDefault | )

Stops an event from propagating.
Close