com.tomtom.sdk.navigation:map-matching-engine-tilestore

This is a library to handle inaccurate locations provided by a location service. Using the raw location to update the current user’s position can lead to a position indicator that is unaligned with the Route. To solve this inaccuracy problem, Map Matching Engine produces accurate (map-matched) locations.

Installation

Add the following repository to the project build.gradle file:

 maven {
url = uri("https://repositories.tomtom.com/artifactory/maven")
}

Add the following dependency to the module build.gradle file:

dependencies {
implementation "com.tomtom.sdk.navigation:map-matching-engine-tilestore:${version}"
}

Usage

To create a MapMatchingEngine instance, use the TileStoreMapMatchingEngineFactory class:

    val tileStoreMapMatchingEngine = TileStoreMapMatchingEngineFactory.create(navigationTileStore)

The NavigationTileStore instance is required to create the MapMatchingEngine. It can be created by calling NavigationTileStore.create() method:

    val navigationTileStoreConfiguration = NavigationTileStoreConfiguration(apiKey = API_KEY)
val navigationTileStore = NavigationTileStore.create(context, navigationTileStoreConfiguration)

Find how to obtain an API key. Once the MapMatchingEngine instance is created, you can use it to match a location to a map.

Depending on GNSS (Global Navigation Satellite System) availability, you can use the following methods:

  • matchLocation - when GNSS is available.

  • extrapolateLocation - when no GNSS input is available, in this case, the location is extrapolated from the last known location.

To match the location to a position on a map, use the matchLocation function:

    val mapMatchingResult = tileStoreMapMatchingEngine.matchLocation(navigationSnapshot)

To extrapolate the location, use the extrapolateLocation function:

    val mapMatchingResult = tileStoreMapMatchingEngine.extrapolateLocation(navigationSnapshot)

TileStoreMapMatchingEngine is a default configuration for OnlineTomTomNavigationFactory.

Packages

This package contains the TileStoreMapMatchingEngineFactory API to create an online-based implementation of MapMatchingEngine.