Sorry, you need to enable JavaScript to visit this website.

Map Driving Extension

Map Driving Extension

This module is built on top of the Maps SDK for Android and contains logic and helpful utils that can be used in more complex scenarios, like driving or cycling.

To use this library, add the following dependency to the build.gradle file:

Map and route matching

Map matching snaps an inaccurate GPS probe to the road network obtained from map tiles so roads are represented by collections of coordinates. Route matching is a special case of map matching which snaps an inaccurate GPS probe to the given route. The reference route is represented by a collection of coordinates. The route can be calculated using the Routing API or provided manually.

Sample use case: You have a speed radar application that is used when driving. To have a proper user experience, you want to match GPS positions with the road data obtained from map tiles.

Sample use case: You want to match/place the chevron with the right road.

Sample use case: A user plans and displays a route on the map in your app. The vehicle position is being matched along the planned route.

First you need to create a proper MatchingDataProvider based on your use case.

To create the MatchingDataProvider from a route:


MatchingDataProvider routeMatchingProvider = LatLngTraceMatchingDataProvider.fromPoints(getFirstRouteFromMap());
val routeMatchingProvider = LatLngTraceMatchingDataProvider.fromPoints(routes.first().getCoordinates())

To create the MatchingDataProvider for map matcher:


MatchingDataProvider matchingDataProvider = tomtomMap.asMatchingDataProvider();
return tomtomMap.asMatchingDataProvider()

After you obtain the MatchingDataProvider, you can create and register matcher in the following manner:


matcher = MatcherFactory.createMatcher(matchingDataProvider);
val matcher = MatcherFactory.createMatcher(matchingDataProvider)

It is important to remove the matcher instance if it is not going to be used. Otherwise memory leaks may occur:



To update map matcher with a new GPS position:



To process map matcher results:


public void onMatched(MatchResult matchResult) {
    ChevronPosition chevronPosition = new ChevronPosition.Builder(matchResult.getMatchedLocation()).build();


                    .position(new LatLng(matchResult.originalLocation))
val chevronPosition = ChevronPosition.Builder(it.matchedLocation).build()
chevron.isDimmed = it.isDimmed
chevron.position = chevronPosition

Follow the chevron

Allow your users to follow their changing positions on the map e.g., when driving. When a new location is set, the animation moves the chevron to the new position.

Sample use case 1: You want to show your user position when driving.

Custom chevron indicator

You can set a custom icon for the chevron indicator.

To create a custom chevron:


ChevronBuilder chevronBuilder = ChevronBuilder.create(activeIcon, inactiveIcon);
chevron = tomtomMap.getDrivingSettings().addChevron(chevronBuilder);
val chevronBuilder = ChevronBuilder.create(activeIcon, inactiveIcon)
chevron = tomtomMap.drivingSettings.addChevron(chevronBuilder)

Chevron tracking mode

Additionally, it is possible to track the chevron. This means that the camera/map and the chevron move when a new location is received so that the map is always centered on the chevron with the bearing of the drive. In the tracking mode, rotate and pan gestures are blocked. The user can only change the zoom level, while the map camera is automatically adjusted to follow the chevron.

To start tracking a selected chevron:



To stop tracking a selected chevron:



You can set the chevron position on the map when in tracking mode.

To change the position:

tomtomMap.drivingSettings.setChevronScreenPosition(ChevronScreenPosition(0.5, 0.75))

To reset/center the position of a chevron:


Chevron overview


Chevron tracking