MapMatchingEngine

public protocol MapMatchingEngine : ManageableEngine

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 the MapMatchingEngine is a MapMatchingResult that contains an accurate (matched) location along with additional information such as alternative and predicted locations (GeoLocation). Depending on the availability of geolocation input data, Map Matcher works in two modes:

  • When available - retrieving a map-matched location based on the input data.
  • When not available - extrapolating the location based on the last known location. It is used when there is no GNSS data available, for instance, when the device is in a tunnel. If there is no last known location, extrapolation is not possible, and 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 (NavigationTileStore). 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:

let navigationTileStoreConfiguration = NavigationTileStoreConfiguration(apiKey: TOMTOM_API_KEY)
let navigationTileStore = try NavigationTileStore(config: navigationTileStoreConfiguration)

To create a map-matching engine, use the TileStoreMapMatchingEngineFactory class:

let mapMatcherEngine = try TileStoreMapMatchingEngineFactory.create(tileStore: navigationTileStore)

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

let mapMatchingResult = try mapMatcherEngine.matchLocation(navigationSnapshot: navigationSnapshot)

To extrapolate the location, use the [extrapolateLocation] function:

let mapMatchingResult = try mapMatcherEngine.extrapolateLocation(navigationSnapshot: navigationSnapshot)

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Attempts to extrapolate location based on the navigation snapshot (NavigationSnapshot), provided we have a previously map-matched result. The method should be used when there is no GNSS input data available (in the tunnel for example).

    Throws

    MapMatchingEngineError if the map matched location can’t be extrapolated from the current location.

    Declaration

    Swift

    func extrapolateLocation(navigationSnapshot: NavigationSnapshot) throws -> MapMatchingResult

    Parameters

    navigationSnapshot

    The snapshot of the current navigation session.

    Return Value

    MapMatchingResult containing a map matched location.

  • Attempts to match location based on the navigation snapshot (NavigationSnapshot), provided we have GNSS input data.

    Throws

    MapMatchingEngineError if the map matcher cannot match the location.

    Declaration

    Swift

    func matchLocation(navigationSnapshot: NavigationSnapshot) throws -> MapMatchingResult

    Parameters

    navigationSnapshot

    The snapshot of the current navigation session.

    Return Value

    A result with the matched location and it’s details