Package-level declarations

Types

Link copied to clipboard
@Serializable
data class Admin(val countryCode: String? = null, val countryCodeAlpha3: String? = null)

An objects describing the administrative boundaries the route leg travels through.

Link copied to clipboard
@Serializable
data class BannerComponents(val text: String, val type: BannerComponents.Type, val subType: BannerComponents.Type? = null, val abbreviation: String? = null, val abbreviationPriority: Int? = null, val imageBaseUrl: String? = null, val imageUrl: String? = null, val directions: List<String>? = null, val active: Boolean? = null)

A part of the BannerText which includes a snippet of the full banner text instruction. In cases where data is available, an image url will be provided to visually include a road shield. To receive this information, your request must have MapboxDirections.Builder#bannerInstructions() set to true.

Link copied to clipboard
@Serializable
data class BannerInstructions(val distanceAlongGeometry: Double, val primary: BannerText, val secondary: BannerText? = null, val sub: BannerText? = null, val view: BannerView? = null)

Visual instruction information related to a particular LegStep useful for making UI elements inside your application such as banners. To receive this information, your request must MapboxDirections.Builder#bannerInstructions() have set to true.

Link copied to clipboard
@Serializable
data class BannerText(val text: String, val components: List<BannerComponents>? = null, val type: StepManeuver.Type? = null, val modifier: ManeuverModifier.Type? = null, val degrees: Double? = null, val drivingSide: String? = null)

Includes both plain text information that can be visualized inside your navigation application along with the text string broken down into BannerComponents which may or may not include a image url. To receive this information, your request must have MapboxDirections.Builder#bannerInstructions() set to true.

Link copied to clipboard
@Serializable
data class BannerView(val text: String, val components: List<BannerComponents>? = null, val type: StepManeuver.Type? = null, val modifier: ManeuverModifier.Type? = null)

Includes both plain text information that can be visualized inside your navigation application along with the text string broken down into BannerComponents which may or may not include a image url. To receive this information, your request must have MapboxDirections.Builder#bannerInstructions() set to true.

Link copied to clipboard
@Serializable
data class Closure(val geometryIndexStart: Int? = null, val geometryIndexEnd: Int? = null)

An object indicating the geometry indexes defining a road closure.

Link copied to clipboard
@Serializable
data class Congestion(val value: Int)

Quantitative descriptor of congestion.

Link copied to clipboard
@Serializable
data class DirectionsResponse(val code: String, val routes: List<DirectionsRoute>, val message: String? = null, val waypoints: List<DirectionsWaypoint>? = null, val uuid: String? = null)

This is the root Mapbox Directions API response. Inside this class are several nested classes chained together to make up a similar structure to the original APIs JSON response.

Link copied to clipboard
@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.

Link copied to clipboard
@Serializable
data class DirectionsWaypoint(val name: String? = null, val location: Point? = null)

An input coordinate snapped to the roads network.

Link copied to clipboard
@Serializable
data class Incident(val id: String, val type: Incident.Type? = null, val closed: Boolean? = null, val congestion: Congestion? = null, val description: String? = null, val longDescription: String? = null, val impact: Incident.Impact? = null, val subType: String? = null, val subTypeDescription: String? = null, val alertcCodes: List<Int>? = null, val geometryIndexStart: Int? = null, val geometryIndexEnd: Int? = null, val creationTime: String? = null, val startTime: String? = null, val endTime: String? = null)

Reproduces one of road incidents type (Type) that might be on the way.

Link copied to clipboard
@Serializable
data class IntersectionLanes(val valid: Boolean? = null, val active: Boolean? = null, val validIndication: String? = null, val indications: List<String>? = null)

Object representing lanes in an intersection.

Link copied to clipboard
@Serializable
data class LegAnnotation(val distance: List<Double>? = null, val duration: List<Double>? = null, val speed: List<Double>? = null, val maxSpeed: List<MaxSpeed>? = null, val congestion: List<String>? = null)

An annotations object that contains additional details about each line segment along the route geometry. Each entry in an annotations field corresponds to a coordinate along the route geometry.

Link copied to clipboard
@Serializable
data class LegStep(val geometry: String, val distance: Double, val duration: Double, val durationTypical: Double? = null, val speedLimitUnit: SpeedLimit.Unit? = null, val speedLimitSign: LegStep.SpeedLimitSign? = null, val name: String? = null, val ref: String? = null, val destinations: String? = null, val mode: String = "driving", val pronunciation: String? = null, val rotaryName: String? = null, val rotaryPronunciation: String? = null, val maneuver: StepManeuver, val voiceInstructions: List<VoiceInstructions>? = null, val bannerInstructions: List<BannerInstructions>? = null, val drivingSide: String? = null, val weight: Double = 1.0, val intersections: List<StepIntersection>? = null, val exits: String? = null)

Includes one StepManeuver object and travel to the following LegStep.

Link copied to clipboard

Constants for the StepManeuver.modifier.

Link copied to clipboard
@Serializable
data class MaxSpeed(val speed: Int? = null, val unit: SpeedLimit.Unit? = null, val unknown: Boolean? = null, val none: Boolean? = null)

Object representing max speeds along a route.

Link copied to clipboard
@Serializable
data class RestStop(val type: String? = null)

An object containing information about passing rest stops along the route. Only available on the DirectionsCriteria.PROFILE_DRIVING profile.

Link copied to clipboard
@Serializable
data class RouteLeg(val distance: Double, val duration: Double, val steps: List<LegStep>, val durationTypical: Double? = null, val summary: String? = null, val admins: List<Admin>? = null, val incidents: List<Incident>? = null, val annotation: LegAnnotation? = null, val closures: List<Closure>? = null)

A route between only two DirectionsWaypoint.

Link copied to clipboard
@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.

Link copied to clipboard
object SpeedLimit

The file exposes speed limit annotations.

Link copied to clipboard
@Serializable
data class StepIntersection(val location: Point, val bearings: List<Int>? = null, val classes: List<String>? = null, val entry: List<Boolean>? = null, val inIndex: Int? = null, val outIndex: Int? = null, val lanes: List<IntersectionLanes>? = null, val geometryIndex: Int? = null, val isUrban: Boolean? = null, val adminIndex: Int? = null, val restStop: RestStop? = null, val tollCollection: TollCollection? = null, val tunnelName: String? = null)

Object representing an intersection along the step.

Link copied to clipboard
@Serializable
data class StepManeuver(val location: Point, val bearingBefore: Double, val bearingAfter: Double, val instruction: String? = null, val type: StepManeuver.Type? = null, val modifier: ManeuverModifier.Type? = null, val exit: Int? = null)

Gives maneuver information about one LegStep.

Link copied to clipboard
@Serializable
data class TollCollection(val type: String? = null)

An object containing information about a toll collection point along the route. This is a payment booth or overhead electronic gantry payment booth or overhead electronic gantry where toll charge is collected. Only available on the DirectionsCriteria.PROFILE_DRIVING profile.

Link copied to clipboard
@Serializable
enum UnitType : Enum<UnitType>
Link copied to clipboard
@Serializable
data class VoiceInstructions(val distanceAlongGeometry: Double, val announcement: String? = null, val ssmlAnnouncement: String? = null)

This class provides information thats useful for properly making navigation announcements at the correct time. Essentially, a distance and a string are given, using Turf Distance measurement methods you can measure the users current location to the next steps maneuver point and if the measured distance is less than the one the API provides, the announcement should be made.

Link copied to clipboard
@Serializable
data class WalkingOptions(val walkingSpeed: Double? = null, val walkwayBias: Double? = null, val alleyBias: Double? = null)

Class for specifying options for use with the walking profile.