DirectionsRoute

@Serializable
data class DirectionsRoute(val geometry: String, val legs: List<RouteLeg>, val distance: Double, val duration: Double, val durationTypical: Double? = null, val weight: Double? = null, val weightName: String? = null, val routeOptions: RouteOptions? = null, val voiceLanguage: String? = null)

Detailed information about an individual route such as the duration, distance and geometry.

Since

1.0.0

Constructors

Link copied to clipboard
constructor(geometry: String, legs: List<RouteLeg>, distance: Double, duration: Double, durationTypical: Double? = null, weight: Double? = null, weightName: String? = null, routeOptions: RouteOptions? = null, voiceLanguage: String? = null)

Types

Link copied to clipboard
class Builder(geometry: String, legs: List<RouteLeg>, distance: Double, duration: Double)

Builder class for creating DirectionsRoute instances.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The distance traveled from origin to destination.

Link copied to clipboard

The estimated travel time from origin to destination.

Link copied to clipboard
@SerialName(value = "duration_typical")
val durationTypical: Double? = null

The typical travel time from this route's origin to destination. There's a delay along this route if you subtract this durationTypical() value from the route's duration() value and the resulting difference is greater than 0. The delay is because of any number of real-world situations (road repair, traffic jam, etc).

Link copied to clipboard

Gives the geometry of the route. Commonly used to draw the route on the map view.

Link copied to clipboard

A Leg is a route between only two waypoints.

Link copied to clipboard

Holds onto the parameter information used when making the directions request. Useful for re-requesting a directions route using the same information previously used.

Link copied to clipboard
@SerialName(value = "voiceLocale")
val voiceLanguage: String? = null

String of the language to be used for voice instructions. Defaults to en, and can be any accepted instruction language. Will be null when the language provided MapboxDirections.Builder#language() via is not compatible with API Voice.

Link copied to clipboard
val weight: Double? = null

The calculated weight of the route.

Link copied to clipboard
@SerialName(value = "weight_name")
val weightName: String? = null

The name of the weight profile used while calculating during extraction phase. The default is routability which is duration based, with additional penalties for less desirable maneuvers.

Functions

Link copied to clipboard

Creates a builder initialized with the current values of the DirectionsRoute instance.

Link copied to clipboard
fun toJson(): String