# 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

OpenLayers.Geometry | A Geometry is a description of a geographic object.
Constructor |
OpenLayers.Geometry | Creates a geometry object.
Functions |
clone | Create a clone of this geometry.
getBounds | Get the bounds for this Geometry.
calculateBounds | Recalculate the bounds for the geometry.
distanceTo | Calculate the closest distance between two geometries (on the x-y plane).
getVertices | Return a list of all points in this geometry.
getCentroid | Calculate the centroid of this geometry.

### Constructor

### OpenLayers.Geometry

Creates a geometry object.

### Functions

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

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

### distanceTo

> distanceTo: function( | geometry,
> | options | )

Calculate the closest distance between two geometries (on the x-y plane).

#### Parameters

geometry | {OpenLayers.Geometry} The target geometry.
options | {Object} Optional properties for configuring the distance calculation.

Valid options depend on the specific geometry type.

#### Returns

{Number | Object} The distance between this geometry and the target. If details is true, the return will be an object with distance, x0, y0, x1, and x2 properties. The x0 and y0 properties represent the coordinates of the closest point on this geometry. The x1 and y1 properties represent the coordinates of the closest point on the target geometry.

### getVertices

> getVertices: function( | nodes | )

Return a list of all points in this geometry.

#### Parameters

nodes | {Boolean} For lines, only return vertices that are endpoints. If false, for lines, only vertices that are not endpoints will be returned. If not provided, all vertices will be returned.

#### Returns

{Array} A list of all vertices in the geometry.

### getCentroid

> getCentroid: function()

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

#### Returns

{OpenLayers.Geometry.Point} The centroid of the collection

> clone: function()

Create a clone of this geometry.

> getBounds: function()

Get the bounds for this Geometry.

> calculateBounds: function()

Recalculate the bounds for the geometry.

> distanceTo: function( | geometry,
> | options | )

Calculate the closest distance between two geometries (on the x-y plane).

> getVertices: function( | nodes | )

Return a list of all points in this geometry.

> getCentroid: function()

Calculate the centroid of this geometry.
Creates a geometry object.
Instances of this class represent bounding boxes.
Point geometry class.
Close