router.Segment

Note

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

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

Name

Returns

Description

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()

Number

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

getCoordinates()

Number[][]

Returns coordinates of a polyline that describes the segment geometry.

getHumanAction()

String

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

getHumanJamsTime()

String

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

getHumanLength()

String

Returns a string representation of segment length with measurement units.

getHumanTime()

String

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

getIndex()

Integer

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

getJamsTime()

Integer

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

getLength()

Number

Returns the length of the segment in meters.

getPolylineEndIndex()

Integer

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

getPolylineStartIndex()

Integer

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

getStreet()

String

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

getTime()

Integer

Returns the segment driving time in seconds.

Methods details

getAction

{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

{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

{Number[][]} getCoordinates()

Returns coordinates of a polyline that describes the segment geometry.

getHumanAction

{String} getHumanAction()

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

getHumanJamsTime

{String} getHumanJamsTime()

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

getHumanLength

{String} getHumanLength()

Returns a string representation of segment length with measurement units.

getHumanTime

{String} getHumanTime()

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

getIndex

{Integer} getIndex()

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

getJamsTime

{Integer} getJamsTime()

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

getLength

{Number} getLength()

Returns the length of the segment in meters.

getPolylineEndIndex

{Integer} getPolylineEndIndex()

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

getPolylineStartIndex

{Integer} getPolylineStartIndex()

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

getStreet

{String} getStreet()

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

getTime

{Integer} getTime()

Returns the segment driving time in seconds.