Automotive Navigation Application

Horizon information

Request access

Horizon information

The HorizonManager provides information about upcoming road conditions, events, and attributes ahead of the vehicle.

Overview

HorizonManager provides functionality for:

  • Observing upcoming road events
  • Detecting speed cameras and enforcement zones
  • Receiving traffic incident notifications
  • Monitoring hazards (weather, road conditions, traffic)
  • Tracking EV charging waypoints

Observable road events

The following specific road events can be observed through the HorizonManager:

Safety Location Events:

  • FixedSpeedCamera - Permanently installed speed cameras
  • MobileCamera - Temporary or mobile speed enforcement
  • SpeedEnforcement - Speed enforcement zones with multiple cameras
  • RedLightCamera - Red light enforcement systems
  • AverageSpeedArea - Average speed monitoring zones
  • FixedDangerZone - Fixed camera danger zones
  • MobileRiskZone - Mobile camera risk zones
  • Restricted - Access-restricted areas

Traffic Events:

  • TrafficJamEvent - Traffic congestion
  • RoadWorkEvent - Road construction and maintenance
  • RoadClosureEvent - Closed roads

Traffic Hazard Events:

  • AccidentEvent - Traffic accidents
  • BrokenDownVehicleEvent - Disabled vehicles
  • WrongWayDriverEvent - Wrong-way driver warnings

Weather Hazard Events:

  • ReducedVisibilityEvent - Poor visibility (fog, heavy rain)
  • SlipperyRoadEvent - Slippery road conditions
  • StrongWindEvent - Strong wind areas

Road Hazard Events:

  • BadRoadConditionsEvent - Poor road surface conditions
  • ObjectsOnRoadEvent - Objects or obstacles on the road (animals, people)

Other Events:

  • RailroadCrossingEvent - Railroad crossings
  • EvWaypointEvent - EV charging waypoints
  • GenericHazardEvent - Unclassified hazards
  • InformativeDirectionEvent - Directional information (highway exits, intersections)
  • PoiEvent - Points of interest

Observing horizon events

Subscribe to receive updates about upcoming road events:

import android.util.Log
import com.tomtom.automotive.integration.client.api.horizon.HorizonManager
import com.tomtom.automotive.integration.client.api.horizon.observehorizonevent.HorizonEventsListener
import com.tomtom.automotive.integration.client.api.horizon.observehorizonevent.HorizonInfo
import com.tomtom.automotive.integration.client.common.Callback
import com.tomtom.automotive.integration.client.common.SdkReleasable
private const val TAG = "HorizonExample"
private var observeHorizonEventsReleasable: SdkReleasable? = null
fun observeHorizonEvents(horizonManager: HorizonManager) {
observeHorizonEventsReleasable = horizonManager.observeHorizonEvents(
object : HorizonEventsListener {
override fun onHorizonEventsChanged(horizonInfo: HorizonInfo) {
Log.d(TAG, "Horizon events updated: $horizonInfo")
horizonInfo.horizonEvents.forEach { event ->
val distanceMeters = event.distanceToEntryPoint.inMeters()
Log.d(TAG, "Event: ${event::class.simpleName} in ${distanceMeters}m")
}
}
override fun onFunctionalityUnavailable(reason: Callback.Reason) {
Log.e(TAG, "Horizon events unavailable: ${reason.devMessage}")
}
}
)
}
fun stopObservingHorizonEvents() {
observeHorizonEventsReleasable?.release()
observeHorizonEventsReleasable = null
}

HorizonInfo structure

The HorizonInfo object contains:

  • horizonEvents - List of upcoming road events

Each event is a specific type implementing the HorizonEvent sealed interface:

  • distanceToEntryPoint - Distance to the start of the event

Processing event types

Handle different types of horizon events using Kotlin’s when expression:

import android.util.Log
import com.tomtom.automotive.integration.client.api.model.horizon.HorizonEvent
private const val TAG = "HorizonExample"
private fun processHorizonEvent(event: HorizonEvent) {
val distanceMeters = event.distanceToEntryPoint.inMeters()
when (event) {
is HorizonEvent.FixedSpeedCamera -> {
val speedLimitKmh = event.speedLimit.inKilometersPerHour()
Log.d(TAG, "Fixed speed camera ahead: $speedLimitKmh km/h limit in ${distanceMeters}m")
}
is HorizonEvent.MobileCamera -> {
val speedLimitKmh = event.speedLimit.inKilometersPerHour()
Log.d(TAG, "Mobile speed camera ahead: $speedLimitKmh km/h limit in ${distanceMeters}m")
}
is HorizonEvent.SpeedEnforcement -> {
val speedLimitKmh = event.speedLimit.inKilometersPerHour()
val exitDistanceMeters = event.distanceToExitPoint.inMeters()
val zoneLength = exitDistanceMeters - distanceMeters
Log.d(TAG, "Speed enforcement zone: $speedLimitKmh km/h for ${zoneLength}m, starting in ${distanceMeters}m")
}
is HorizonEvent.TrafficJamEvent -> {
val delaySeconds = event.delay.inSeconds()
Log.d(TAG, "Traffic jam ahead in ${distanceMeters}m, delay: ${delaySeconds}s")
}
is HorizonEvent.RoadWorkEvent -> {
val delaySeconds = event.delay.inSeconds()
Log.d(TAG, "Road work ahead in ${distanceMeters}m, delay: ${delaySeconds}s")
}
is HorizonEvent.RailroadCrossingEvent -> {
Log.d(TAG, "Railroad crossing ahead in ${distanceMeters}m")
}
is HorizonEvent.EvWaypointEvent -> {
Log.d(TAG, "EV charging waypoint ahead in ${distanceMeters}m")
}
is HorizonEvent.AccidentEvent -> {
Log.d(TAG, "Accident ahead in ${distanceMeters}m")
}
is HorizonEvent.SlipperyRoadEvent -> {
Log.d(TAG, "Slippery road ahead in ${distanceMeters}m")
}
is HorizonEvent.StrongWindEvent -> {
Log.d(TAG, "Strong wind area ahead in ${distanceMeters}m")
}
else -> {
Log.d(TAG, "Other event: ${event::class.simpleName} in ${distanceMeters}m")
}
}
}

EV waypoint events

Track charging stops along the route. Charging stations are categorized by their power output:

CategoryPower RangeExample
SLOW< 12 kW10 kW charger
REGULAR12 kW - 49 kW20 kW charger
FAST≥ 50 kW70 kW charger
import android.util.Log
import com.tomtom.automotive.integration.client.api.model.horizon.ChargingStopType
import com.tomtom.automotive.integration.client.api.model.horizon.HorizonEvent
private const val TAG = "HorizonExample"
private fun handleEvWaypoint(event: HorizonEvent.EvWaypointEvent, distanceMeters: Double) {
val chargingType = event.chargingStopType
val chargerDescription = when (chargingType) {
ChargingStopType.FAST -> "Fast charger (≥50 kW)"
ChargingStopType.REGULAR -> "Regular charger (12-49 kW)"
ChargingStopType.SLOW -> "Slow charger (<12 kW)"
ChargingStopType.UNHANDLED -> "Charging station"
}
Log.d(TAG, "$chargerDescription ahead in ${distanceMeters}m")
}

Hazard events

Handle weather and road hazards:

import android.util.Log
import com.tomtom.automotive.integration.client.api.model.horizon.HorizonEvent
import com.tomtom.automotive.integration.client.api.model.horizon.ReducedVisibilityReason
private const val TAG = "HorizonExample"
private fun processHazardEvents(event: HorizonEvent) {
when (event) {
is HorizonEvent.ReducedVisibilityEvent -> {
val reasons = event.reasons.joinToString { reason ->
when (reason) {
ReducedVisibilityReason.FOG -> "fog"
ReducedVisibilityReason.HEAVY_RAIN -> "heavy rain"
ReducedVisibilityReason.UNHANDLED -> "reduced visibility"
}
}
Log.d(TAG, "Reduced visibility ahead due to: $reasons")
}
is HorizonEvent.SlipperyRoadEvent -> {
Log.d(TAG, "Slippery road conditions ahead")
}
is HorizonEvent.StrongWindEvent -> {
Log.d(TAG, "Strong wind area ahead")
}
is HorizonEvent.BadRoadConditionsEvent -> {
Log.d(TAG, "Bad road conditions ahead")
}
is HorizonEvent.ObjectsOnRoadEvent -> {
Log.d(TAG, "Objects on road ahead")
}
is HorizonEvent.BrokenDownVehicleEvent -> {
Log.d(TAG, "Broken down vehicle ahead")
}
is HorizonEvent.WrongWayDriverEvent -> {
Log.d(TAG, "Wrong way driver reported ahead")
}
else -> { }
}
}