# OpenLayers.Geometry.LineString

A LineString is a Curve which, once two points have been added to it, can never be less than two points long.

#### Inherits from

Summary
 OpenLayers. Geometry. LineString A LineString is a Curve which, once two points have been added to it, can never be less than two points long. Constructor OpenLayers. Geometry. LineString Create a new LineString geometry Functions removeComponent Only allows removal of a point if there are three or more points in the linestring. intersects Test for instersection between two geometries. getVertices Return a list of all points in this geometry. distanceTo Calculate the closest distance between two geometries (on the x-y plane).

### OpenLayers.Geometry.LineString

Create a new LineString geometry

#### Parameters

 points {Array(OpenLayers.Geometry.Point)} An array of points used to generate the linestring

### removeComponent

 removeComponent: function( point )

Only allows removal of a point if there are three or more points in the linestring.  (otherwise the result would be just a single point)

#### Parameters

 point {OpenLayers.Geometry.Point} The point to be removed

### intersects

 intersects: function( geometry )

Test for instersection between two geometries.  This is a cheapo implementation of the Bently-Ottmann algorigithm.  It doesn’t really keep track of a sweep line data structure.  It is closer to the brute force method, except that segments are sorted and potential intersections are only calculated when bounding boxes intersect.

#### Parameters

 geometry {OpenLayers.Geometry}

#### Returns

{Boolean} The input geometry intersects this 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.

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

 details {Boolean} Return details from the distance calculation.  Default is false. edge {Boolean} Calculate the distance from this geometry to the nearest edge of the target geometry.  Default is true.  If true, calling distanceTo from a geometry that is wholly contained within the target will result in a non-zero distance.  If false, whenever geometries intersect, calling distanceTo will return 0.  If false, details cannot be returned.

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

 removeComponent: function( point )
Only allows removal of a point if there are three or more points in the linestring.
 intersects: function( geometry )
Test for instersection between two geometries.
 getVertices: function( nodes )
Return a list of all points in this geometry.
 distanceTo: function( geometry, options )
Calculate the closest distance between two geometries (on the x-y plane).
A Curve is a MultiPoint, whose points are assumed to be connected.
Point geometry class.
A Geometry is a description of a geographic object.