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

# router.Segment

{% note info %}

The constructor of the router.Segment class is hidden, as this class is not intended for autonomous initialization.

{% endnote %}

Object that describes a segment of the route. A segment is a part of the route from one maneuver to the next. The constructor is not available in the package.full (a standard set of modules). This module is loaded on demand.

[Methods](#methods-summary)

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [getAction](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getAction)() | String | Returns the direction the route turns at the end of the segment. Possible values: 
- left - Left.
- slight left - Slightly left.
- hard left - Sharp left turn.
- right - Right.
- slight right - Slightly right.
- hard right - Sharp right turn.
- none - Straight.
- back - Turn around.
- enter roundabout - Entrance to a roundabout intersection.
- leave roundabout [N] - Exit from a roundabout intersection. The number N is the number of the turn on the circle. This number can be omitted. For example, "leave roundabout" or "leave roundabout 2".
- merge - Entrance to a highway. Signifies merging with traffic.
- board ferry - Ferry crossing. ||
|| [getAngle](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getAngle)() | Number | Checks the angle at which the route turns at the end of the segment. ||
|| [getCoordinates](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getCoordinates)() | Number[][] | Returns coordinates of a polyline that describes the segment geometry. ||
|| [getHumanAction](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getHumanAction)() | String | Returns the direction of the turn in the form of a localized human-readable string. ||
|| [getHumanJamsTime](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getHumanJamsTime)() | String | Returns a string representation of segment driving time with measurement units, with consideration for traffic. ||
|| [getHumanLength](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getHumanLength)() | String | Returns a string representation of segment length with measurement units. ||
|| [getHumanTime](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getHumanTime)() | String | Returns a string representation of segment driving time with measurement units. ||
|| [getIndex](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getIndex)() | Integer | Returns the index of the given segment in the array of all the segments in the path. ||
|| [getJamsTime](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getJamsTime)() | Integer | Returns the segment driving time in seconds, with consideration for traffic. ||
|| [getLength](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getLength)() | Number | Returns the length of the segment in meters. ||
|| [getPolylineEndIndex](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getPolylineEndIndex)() | Integer | Returns the index of the point in the path geometry at which the segment ends. ||
|| [getPolylineStartIndex](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getPolylineStartIndex)() | Integer | Returns the index of the point in the path geometry from which the segment begins. ||
|| [getStreet](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getStreet)() | String | Returns the name of the street that the segment of the route goes along. ||
|| [getTime](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/router.Segment.md#getTime)() | Integer | Returns the segment driving time in seconds.||
|#

## Methods details {#method_detail}


### getAction {#getAction}

```javascript
{String} getAction()
```

**Returns** the direction the route turns at the end of the segment. Possible values: 
- left - Left.
- slight left - Slightly left.
- hard left - Sharp left turn.
- right - Right.
- slight right - Slightly right.
- hard right - Sharp right turn.
- none - Straight.
- back - Turn around.
- enter roundabout - Entrance to a roundabout intersection.
- leave roundabout [N] - Exit from a roundabout intersection. The number N is the number of the turn on the circle. This number can be omitted. For example, "leave roundabout" or "leave roundabout 2".
- merge - Entrance to a highway. Signifies merging with traffic.
- board ferry - Ferry crossing.

### getAngle {#getAngle}

```javascript
{Number} getAngle()
```

Checks the angle at which the route turns at the end of the segment.

**Returns** the angle of the turn (in degrees).

### getCoordinates {#getCoordinates}

```javascript
{Number[][]} getCoordinates()
```

**Returns** coordinates of a polyline that describes the segment geometry.

### getHumanAction {#getHumanAction}

```javascript
{String} getHumanAction()
```

**Returns** the direction of the turn in the form of a localized human-readable string.

### getHumanJamsTime {#getHumanJamsTime}

```javascript
{String} getHumanJamsTime()
```

**Returns** a string representation of segment driving time with measurement units, with consideration for traffic.

### getHumanLength {#getHumanLength}

```javascript
{String} getHumanLength()
```

**Returns** a string representation of segment length with measurement units.

### getHumanTime {#getHumanTime}

```javascript
{String} getHumanTime()
```

**Returns** a string representation of segment driving time with measurement units.

### getIndex {#getIndex}

```javascript
{Integer} getIndex()
```

**Returns** the index of the given segment in the array of all the segments in the path.

### getJamsTime {#getJamsTime}

```javascript
{Integer} getJamsTime()
```

**Returns** the segment driving time in seconds, with consideration for traffic.

### getLength {#getLength}

```javascript
{Number} getLength()
```

**Returns** the length of the segment in meters.

### getPolylineEndIndex {#getPolylineEndIndex}

```javascript
{Integer} getPolylineEndIndex()
```

**Returns** the index of the point in the path geometry at which the segment ends.

### getPolylineStartIndex {#getPolylineStartIndex}

```javascript
{Integer} getPolylineStartIndex()
```

**Returns** the index of the point in the path geometry from which the segment begins.

### getStreet {#getStreet}

```javascript
{String} getStreet()
```

**Returns** the name of the street that the segment of the route goes along.

### getTime {#getTime}

```javascript
{Integer} getTime()
```

**Returns** the segment driving time in seconds.