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.
OpenLayers. | A Geometry is a description of a geographic object. |
Constructor | |
OpenLayers. | 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. |
clone: function()
Create a clone of this geometry. Does not set any non-standard properties of the cloned geometry.
{OpenLayers.Geometry} An exact clone of this geometry.
distanceTo: function( geometry, options )
Calculate the closest distance between two geometries (on the x-y plane).
geometry | {OpenLayers.Geometry} The target geometry. |
options | {Object} Optional properties for configuring the distance calculation. |
Valid options depend on the specific geometry type.
{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: function( nodes )
Return a list of all points in this geometry.
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. |
{Array} A list of all vertices in the geometry.
getCentroid: function()
Calculate the centroid of this geometry. This method is defined in subclasses.
{OpenLayers.Geometry.Point} The centroid of the collection
Create a clone of this geometry.
clone: function()
Get the bounds for this Geometry.
getBounds: function()
Recalculate the bounds for the geometry.
calculateBounds: function()
Calculate the closest distance between two geometries (on the x-y plane).
distanceTo: function( geometry, options )
Return a list of all points in this geometry.
getVertices: function( nodes )
Calculate the centroid of this geometry.
getCentroid: function()