MapMatchingEngine
Interface to a Map Matcher Engine.
Map Matcher is a component that tries to match position input (includes GNSS data, existing route) to a point on a map. The output of MapMatchingEngine is a map-matching result that contains an accurate (matched) location along with additional information such as alternative and predicted locations. If no input position is currently available (e.g., the vehicle is in a tunnel and GNSS signal is lost), the old matched location is extrapolated. If there is no previous matched location, the map-matching result is null.
The Navigation SDK provides factories to create map matcher engines. One of them is the TileStoreMapMatchingEngineFactory which creates a map matcher engine. This factory creates an engine that attempts to match the position input to the navigation tile data (provided by an online map). To do so, it uses a map-based tile data store. A client application must specify the data store when creating the engine.
To create a NavigationTileStore an API key is required. With the key you configure the store by setting up the NavigationTileStoreConfiguration:
val navigationTileStoreConfiguration = NavigationTileStoreConfiguration(apiKey = TOMTOM_API_KEY)
val navigationTileStore = NavigationTileStore.create(context, navigationTileStoreConfiguration)To create a map-matching engine, use the TileStoreMapMatchingEngineFactory class:
val mapMatcherEngine = TileStoreMapMatchingEngineFactory.create(navigationTileStore)To match the location to a position on a map, use the matchLocation function:
val mapMatchingResult = mapMatcherEngine.matchLocation(navigationSnapshot)To extrapolate the location, use the extrapolateLocation function:
val mapMatchingResult = mapMatcherEngine.extrapolateLocation(navigationSnapshot)