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

Map and route matching

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