---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometry.base.LineString.md
  - https://yandex.com/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/geometry.base.LineString.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/jsapi-v2-1/doc/en/llms.txt

# geometry.base.LineString

Extends [IBaseLineStringGeometry](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBaseLineStringGeometry.md).

The "Polyline" base geometry.

[Constructor](#constructor-summary) | [Fields](#properties-summary) | [Events](#events-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
geometry.base.LineString([coordinates])
```

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`coordinates`](#param-coordinates) | [] | Type: Number[][]

Geometry coordinates. ||
|#


**Example:**

```javascript
var lineString = new ymaps.geometry.base.LineString([
    [30, 50], [31, 51], [32, 52]
]);
//...
lineString.set(1, [20, 40]).remove(2);
```

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometry.base.LineString.md#events) | [event.Manager](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/event.Manager.md)| Geometry event manager. ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [change](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#event-change)| Changed coordinates. Instance of the [Event](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- oldCoordinates - Old coordinates
- newCoordinates - New coordinates.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#event-change). ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [freeze](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#freeze)() | [IFreezable](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md)
| Switches the object to "frozen" mode.

Inherited from [IFreezable](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#freeze). ||
|| [get](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#get)([index](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#get-param-index)) | Number[]
| Returns coordinates of the point with the specified index.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#get). ||
|| [getBounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBaseGeometry.md#getBounds)() | Number[][]\|null
| Returns coordinates of the two opposite corners of the area that surrounds the geometry. The first item in the array is the corner with the smallest coordinate values relative to the rest of the points in the area; the second item is the corner with the largest coordinate values.

Inherited from [IBaseGeometry](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBaseGeometry.md#getBounds). ||
|| [getChildGeometry](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getChildGeometry)([index](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getChildGeometry-param-index)) | [IPointGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPointGeometryAccess.md)
| Creates and returns an [IPointGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPointGeometryAccess.md) object for the specified vertex on the polyline.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getChildGeometry). ||
|| [getClosest](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getClosest)([anchorPosition](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getClosest-param-anchorPosition)) | Object
| Searches for a point on the polyline closest to the anchorPosition.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getClosest). ||
|| [getCoordinates](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getCoordinates)() | Number[][]
| Returns an array of geometry coordinates.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getCoordinates). ||
|| [getLength](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getLength)() | Integer
| Returns the number of points in the geometry.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#getLength). ||
|| [getType](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBaseLineStringGeometry.md#getType)() | String
| Returns the "LineString" string.

Inherited from [IBaseLineStringGeometry](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IBaseLineStringGeometry.md#getType). ||
|| [insert](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#insert)([index](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#insert-param-index), [coordinates](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#insert-param-coordinates)) | [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md)
| Adds a new point with the specified index.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#insert). ||
|| [isFrozen](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#isFrozen)() | Boolean
| Returns true if the object is in "frozen" mode, otherwise false.

Inherited from [IFreezable](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#isFrozen). ||
|| [remove](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#remove)([index](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#remove-param-index)) | Number[]
| Removes the point with the specified index.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#remove). ||
|| [set](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#set)([index](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#set-param-index), [coordinates](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#set-param-coordinates)) | [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md)
| Sets coordinates of the point with the specified index.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#set). ||
|| [setCoordinates](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#setCoordinates)([coordinates](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#setCoordinates-param-coordinates)) | [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md)
| Sets an array of geometry coordinates.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#setCoordinates). ||
|| [splice](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#splice)([index](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#splice-param-index), [number](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#splice-param-number)) | Number[][]
| Deletes a defined number of points, starting from the specified index. New points can be added in place of the deleted ones. Coordinates of the new points can be passed as additional arguments after the "number" parameter.

Inherited from [ILineStringGeometryAccess](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILineStringGeometryAccess.md#splice). ||
|| [unfreeze](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#unfreeze)() | [IFreezable](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md)
| Switches the object to active mode.

Inherited from [IFreezable](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#unfreeze). ||
|#

## Fields details {#field_detail}

### events {#events}

```javascript
{event.Manager} events
```

Geometry event manager.
