OpenLayers. Geometry

A Geometry is a description of a geographic object.  Create an instance of this class with the OpenLayers.Geometry constructor.  This is a base class, typical geometry types are described by subclasses of this class.

Summary
A Geometry is a description of a geographic object.
{String} A unique identifier for this geometry.
{OpenLayers.Geometry}This is set when a Geometry is added as component of another geometry
{OpenLayers.Bounds} The bounds of this geometry
Creates a geometry object.
Destroy this geometry.
Create a clone of this geometry.
Nullify this components bounds and that of its parent as well.
Extend the existing bounds to include the new bounds.
Get the bounds for this Geometry.
Recalculate the bounds for the geometry.
Calculate the length of this geometry.
Calculate the area of this geometry.
Returns the Well-Known Text representation of a geometry

Properties

id

{String} A unique identifier for this geometry.

parent

{OpenLayers.Geometry}This is set when a Geometry is added as component of another geometry

bounds

{OpenLayers.Bounds} The bounds of this geometry

Constructor

OpenLayers. Geometry

Creates a geometry object.

Functions

destroy

destroy: function()

Destroy this geometry.

clone

clone: function()

Create a clone of this geometry.  Does not set any non-standard properties of the cloned geometry.

Returns

{OpenLayers.Geometry} An exact clone of this geometry.

clearBounds

clearBounds: function()

Nullify this components bounds and that of its parent as well.

extendBounds

extendBounds: function(newBounds)

Extend the existing bounds to include the new bounds.  If geometry’s bounds is not yet set, then set a new Bounds.

Parameters

newBounds{OpenLayers.Bounds}

getBounds

getBounds: function()

Get the bounds for this Geometry.  If bounds is not set, it is calculated again, this makes queries faster.

Returns

{OpenLayers.Bounds}

calculateBounds

calculateBounds: function()

Recalculate the bounds for the geometry.

atPoint

atPoint: function(lonlat,
toleranceLon,
toleranceLat)
NoteThis is only an approximation based on the bounds of the geometry.

Parameters

lonlat{OpenLayers.LonLat}
toleranceLon{float} Optional tolerance in Geometric Coords
toleranceLat{float} Optional tolerance in Geographic Coords

Returns

{Boolean} Whether or not the geometry is at the specified location

getLength

getLength: function()

Calculate the length of this geometry.  This method is defined in subclasses.

Returns

{Float} The length of the collection by summing its parts

getArea

getArea: function()

Calculate the area of this geometry.  This method is defined in subclasses.

Returns

{Float} The area of the collection by summing its parts

toString

toString: function()

Returns the Well-Known Text representation of a geometry

Returns

{String} Well-Known Text

Creates a geometry object.
Instances of this class represent bounding boxes.
destroy: function()
Destroy this geometry.
clone: function()
Create a clone of this geometry.
clearBounds: function()
Nullify this components bounds and that of its parent as well.
extendBounds: function(newBounds)
Extend the existing bounds to include the new bounds.
getBounds: function()
Get the bounds for this Geometry.
calculateBounds: function()
Recalculate the bounds for the geometry.
atPoint: function(lonlat,
toleranceLon,
toleranceLat)
getLength: function()
Calculate the length of this geometry.
getArea: function()
Calculate the area of this geometry.
toString: function()
Returns the Well-Known Text representation of a geometry
This class represents a longitude and latitude pair