RouteOptions

@Serializable
data class RouteOptions(val baseUrl: String, val user: String, val profile: String, val coordinates: List<@Serializable(with = PointSerializer::class) Point>, val alternatives: Boolean? = null, val language: String? = null, val radiuses: String? = null, val bearings: String? = null, val continueStraight: Boolean? = null, val roundaboutExits: Boolean? = null, val geometries: String? = null, val overview: String? = null, val steps: Boolean? = null, val annotations: String? = null, val exclude: String? = null, val voiceInstructions: Boolean? = null, val bannerInstructions: Boolean? = null, val voiceUnits: UnitType? = null, val accessToken: String? = null, val requestUuid: String? = null, val approaches: String? = null, val waypointIndices: String? = null, val waypointNames: String? = null, val waypointTargets: String? = null, val walkingOptions: WalkingOptions? = null, val snappingClosures: String? = null)

Provides information connected to your request that help when a new directions request is needing using the identical parameters as the original request.

For example, if I request a driving (profile) with alternatives and continueStraight set to true. I make the request but loose reference and information which built the original request. Thus, If I only want to change a single variable such as the destination coordinate, i'd have to have all the other route information stores so the request was made identical to the previous but only now using this new destination point.

Using this class can provide you wth the information used when the DirectionsRoute was made.

Since

3.0.0

Constructors

Link copied to clipboard
constructor(baseUrl: String, user: String, profile: String, coordinates: List<@Serializable(with = PointSerializer::class) Point>, alternatives: Boolean? = null, language: String? = null, radiuses: String? = null, bearings: String? = null, continueStraight: Boolean? = null, roundaboutExits: Boolean? = null, geometries: String? = null, overview: String? = null, steps: Boolean? = null, annotations: String? = null, exclude: String? = null, voiceInstructions: Boolean? = null, bannerInstructions: Boolean? = null, voiceUnits: UnitType? = null, accessToken: String? = null, requestUuid: String? = null, approaches: String? = null, waypointIndices: String? = null, waypointNames: String? = null, waypointTargets: String? = null, walkingOptions: WalkingOptions? = null, snappingClosures: String? = null)

Types

Link copied to clipboard
class Builder(baseUrl: String, user: String, profile: String, coordinates: List<@Serializable(with = PointSerializer::class) Point>)

Builder class for creating RouteOptions instances.

Properties

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

A valid access token that will included to the request.

Link copied to clipboard
val alternatives: Boolean? = null

Whether to try to return alternative routes (true) or not (false, default). An alternative route is a route that is significantly different than the fastest route, but also still reasonably fast. Such a route does not exist in all circumstances. Up to two alternatives may be returned. This is available for NavigationRoute.PROFILE_DRIVING_TRAFFIC, NavigationRoute.PROFILE_DRIVING, NavigationRoute.PROFILE_CYCLING.

Link copied to clipboard
val annotations: String? = null

A comma-separated list of annotations. Defines whether to return additional metadata along the route. Possible values are: NavigationRoute.ANNOTATION_DISTANCE NavigationRoute.ANNOTATION_CONGESTION NavigationRoute.ANNOTATION_MAXSPEED See the RouteLeg object for more details on what is included with annotations. Must be used in conjunction with overview=full.

Link copied to clipboard
val approaches: String? = null

Indicates from which side of the road to approach a waypoint. Accepts NavigationRoute.APPROACH_UNRESTRICTED (default) or NavigationRoute.APPROACH_CURB . If set to NavigationRoute.APPROACH_UNRESTRICTED, the route can approach waypoints from either side of the road. If set to NavigationRoute.APPROACH_CURB, the route will be returned so that on arrival, the waypoint will be found on the side that corresponds with the driving_side of the region in which the returned route is located. If provided, the list of approaches must be the same length as the list of waypoints.

Link copied to clipboard
@SerialName(value = "banner_instructions")
val bannerInstructions: Boolean? = null

Whether to return banner objects associated with the route steps (true) or not (false, default). Must be used in conjunction with RouteOptions.steps=true

Link copied to clipboard

The same base URL which was used during the request that resulted in this root directions response.

Link copied to clipboard
val bearings: String? = null

Influences the direction in which a route starts from a waypoint. Used to filter the road segment the waypoint will be placed on by direction. This is useful for making sure the new routes of rerouted vehicles continue traveling in their current direction. A request that does this would provide bearing and radius values for the first waypoint and leave the remaining values empty. Returns two comma-separated values per waypoint: an angle clockwise from true north between 0 and 360, and the range of degrees by which the angle can deviate (recommended value is 45° or 90°), formatted as {angle, degrees}. If provided, the list of bearings must be the same length as the list of coordinates.

Link copied to clipboard
@SerialName(value = "continue_straight")
val continueStraight: Boolean? = null

The allowed direction of travel when departing intermediate waypoints. If true, the route will continue in the same direction of travel. If false, the route may continue in the opposite direction of travel. Defaults to true for NavigationRoute.PROFILE_DRIVING and false for NavigationRoute.PROFILE_WALKING and NavigationRoute.PROFILE_CYCLING.

Link copied to clipboard
val coordinates: List<@Serializable(with = PointSerializer::class) Point>

A list of Points to visit in order. There can be between two and 25 coordinates for most requests, or up to three coordinates for NavigationRoute.PROFILE_DRIVING_TRAFFIC requests. Note that these coordinates are different than the direction responses DirectionsWaypoints that these are the non-snapped coordinates.

Link copied to clipboard
val exclude: String? = null

Exclude certain road types from routing. The default is to not exclude anything from the profile selected. The following exclude flags are available for each profile:

Link copied to clipboard
val geometries: String? = null

The format of the returned geometry. Allowed values are: NavigationRoute.GEOMETRY_POLYLINE (default, a polyline with a precision of five decimal places), NavigationRoute.GEOMETRY_POLYLINE6 (a polyline with a precision of six decimal places).

Link copied to clipboard
val language: String? = null

The language of returned turn-by-turn text instructions. The default is en (English).

Link copied to clipboard
val overview: String? = null

Displays the requested type of overview geometry. Can be NavigationRoute.OVERVIEW_FULL (the most detailed geometry available), NavigationRoute.OVERVIEW_SIMPLIFIED (default, a simplified version of the full geometry), or NavigationRoute.OVERVIEW_FALSE (no overview geometry).

Link copied to clipboard

The routing profile to use. Possible values are NavigationRoute.PROFILE_DRIVING_TRAFFIC, NavigationRoute.PROFILE_DRIVING, NavigationRoute.PROFILE_WALKING, or NavigationRoute.PROFILE_CYCLING. The same profile which was used during the request that resulted in this root directions response. MapboxDirections.Builder ensures that a profile is always set even if the MapboxDirections requesting object doesn't specifically set a profile.

Link copied to clipboard
val radiuses: String? = null

The maximum distance a coordinate can be moved to snap to the road network in meters. There must be as many radiuses as there are coordinates in the request, each separated by ;. Values can be any number greater than 0, the string unlimited or empty string.

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

A universally unique identifier (UUID) for identifying and executing a similar specific route in the future.

Link copied to clipboard
@SerialName(value = "roundabout_exits")
val roundaboutExits: Boolean? = null

Whether to emit instructions at roundabout exits (true) or not (false, default). Without this parameter, roundabout maneuvers are given as a single instruction that includes both entering and exiting the roundabout. With roundabout_exits=true, this maneuver becomes two instructions, one for entering the roundabout and one for exiting it. Must be used in conjunction with RouteOptions.steps=true.

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

A semicolon-separated list of booleans affecting snapping of waypoint locations to road segments. If true, road segments closed due to live-traffic closures will be considered for snapping. If false, they will not be considered for snapping. If provided, the number of snappingClosures must be the same as the number of coordinates. Must be used with NavigationRoute.PROFILE_DRIVING_TRAFFIC

Link copied to clipboard
val steps: Boolean? = null

Whether to return steps and turn-by-turn instructions (true) or not (false, default). If steps is set to true, the following guidance-related parameters will be available: RouteOptions.bannerInstructions, RouteOptions.language, RouteOptions.roundaboutExits, RouteOptions.voiceInstructions, RouteOptions.voiceUnits, RouteOptions.waypointNames, RouteOptions.waypointTargets, waypoints from RouteOptions.coordinates

Link copied to clipboard

The same user which was used during the request that resulted in this root directions response.

Link copied to clipboard
@SerialName(value = "voice_instructions")
val voiceInstructions: Boolean? = null

Whether to return SSML marked-up text for voice guidance along the route (true) or not (false, default). Must be used in conjunction with RouteOptions.steps=true.

Link copied to clipboard
@SerialName(value = "voice_units")
val voiceUnits: UnitType? = null

A type of units to return in the text for voice instructions. Can be UnitType.IMPERIAL (default) or UnitType.METRIC. Must be used in conjunction with RouteOptions.steps=true and RouteOptions.voiceInstructions ()}=true.

Link copied to clipboard

To be used to specify settings for use with the walking profile.

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

Indicates which input coordinates should be treated as waypoints.

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

A semicolon-separated list of custom names for entries in the list of RouteOptions.coordinates, used for the arrival instruction in banners and voice instructions. Values can be any string, and the total number of all characters cannot exceed

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

A semicolon-separated list of coordinate pairs used to specify drop-off locations that are distinct from the locations specified in coordinates. If this parameter is provided, the Directions API will compute the side of the street, left or right, for each target based on the waypoint_targets and the driving direction. The maneuver.modifier, banner and voice instructions will be updated with the computed side of street. The number of waypoint targets must be the same as the number of coordinates. Must be used with RouteOptions.steps = true.

Functions

Link copied to clipboard

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