Leg

@Serializable
data class Leg(val start: Destination, val end: Destination, val transitMode: TravelMode, val distance: Double, val duration: Double, val coordinates: List<@Serializable(with = CompressedCoordinateSerializer::class) Coordinate>, val steps: List<Step>)

A single leg of an itinerary, travelled with one transit mode between two destinations.

Constructors

Link copied to clipboard
constructor(start: Destination, end: Destination, transitMode: TravelMode, distance: Double, duration: Double, coordinates: List<@Serializable(with = CompressedCoordinateSerializer::class) Coordinate>, steps: List<Step>)

Properties

Link copied to clipboard
@SerialName(value = "coords")
val coordinates: List<@Serializable(with = CompressedCoordinateSerializer::class) Coordinate>

The coordinates describing the geometry of the leg.

Link copied to clipboard

The distance of the leg, in meters.

Link copied to clipboard

The duration of the leg, in seconds.

Link copied to clipboard

The destination at which the leg ends.

Link copied to clipboard

The destination at which the leg starts.

Link copied to clipboard

The steps composing the leg.

Link copied to clipboard

The transit mode used to travel the leg.

Functions

Link copied to clipboard
open override fun toString(): String

Returns the leg's endpoints and totals, with coordinates and steps reduced to their sizes.