Util - OpenLayers

# Util

Summary

Util |
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).
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)
IS_GECKO | {Boolean} True if the userAgent reports the browser to use the Gecko engine
CANVAS_SUPPORTED | {Boolean} True if canvas 2d is supported.
BROWSER_NAME | {String} A substring of the navigator.userAgent property.
Functions |
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

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

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

### IS_GECKO

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

### CANVAS_SUPPORTED

{Boolean} True if canvas 2d is supported.

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

### 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.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.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 longitude and latitude pair
Close