TrafficOverrideOptions

class TrafficOverrideOptions

Traffic override related config

In order to update traffic it is necessary to request routes with specific RouteOptions. At a minimum the following options are necessary:

val routeOptions = RouteOptions.builder()
.baseUrl(Constants.BASE_API_URL)
.user(Constants.MAPBOX_USER)
.profile(DirectionsCriteria.PROFILE_DRIVING_TRAFFIC)
.overview(DirectionsCriteria.OVERVIEW_FULL)
.steps(true)
.annotationsList(
listOf(
DirectionsCriteria.ANNOTATION_CONGESTION_NUMERIC,
DirectionsCriteria.ANNOTATION_MAXSPEED,
DirectionsCriteria.ANNOTATION_DISTANCE,
)
)
.coordinatesList(listOf(origin, destination))
.build()

A good starting point might be RouteOptions.Builder.applyDefaultNavigationOptions() which will include the options above.

Parameters

isEnabled

defines if traffic override is enabled

highSpeedThresholdInKmPerHour

defines what speed should be treated as a high speed

lowCongestionRange

the range for low congestion traffic

moderateCongestionRange

the range for moderate congestion traffic

heavyCongestionRange

the range for heavy congestion traffic

severeCongestionRange

the range for severe congestion traffic

Types

Link copied to clipboard
class Builder

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Regenerate whenever a change is made

Link copied to clipboard
open override fun hashCode(): Int

Regenerate whenever a change is made

Link copied to clipboard
fun toBuilder(): TrafficOverrideOptions.Builder

Get a builder to customize a subset of current options.

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

Returns a string representation of the object.

Properties

Link copied to clipboard
val heavyCongestionRange: IntRange
Link copied to clipboard
val highSpeedThresholdInKmPerHour: Int
Link copied to clipboard
val isEnabled: Boolean
Link copied to clipboard
val lowCongestionRange: IntRange
Link copied to clipboard
val moderateCongestionRange: IntRange
Link copied to clipboard
val severeCongestionRange: IntRange