MatchOptions

open class MatchOptions: DirectionsOptions

A MatchOptions object is a structure that specifies the criteria for results returned by the Mapbox Map Matching API.

Pass an instance of this class into the Directions.calculate(_:completionHandler:) method.

  • Initializes a match options object for matching locations against the road network.

    Declaration

    Swift

    public convenience init(locations: [CLLocation], profileIdentifier: MBDirectionsProfileIdentifier? = nil)

    Parameters

    location

    An array of CLLocation objects representing locations the route should try to match the road network against. The array should contain at least two locations (the source and destination) and at most 25 waypoints. (Some profiles, such as MBDirectionsProfileIdentifierAutomobileAvoidingTraffic, may have lower limits.)

    profileIdentifier

    A string specifying the primary mode of transportation for the routes. This parameter, if set, should be set to MBDirectionsProfileIdentifierAutomobile, MBDirectionsProfileIdentifierAutomobileAvoidingTraffic, MBDirectionsProfileIdentifierCycling, or MBDirectionsProfileIdentifierWalking. MBDirectionsProfileIdentifierAutomobile is used by default.

  • Declaration

    Swift

    @objc public required init(waypoints: [Waypoint], profileIdentifier: MBDirectionsProfileIdentifier?)
  • If true, the input locations are re-sampled for improved map matching results. The default is false.

    Declaration

    Swift

    @objc open var resamplesTraces: Bool = false
  • An index set containing indices of two or more items in coordinates. These will be represented by Waypoints in the resulting Match objects.

    Use this property when the includesSteps property is true or when coordinates represents a trace with a high sample rate. If this property is nil, the resulting Match objects contain a waypoint for each coordinate in the match options.

    If specified, each index must correspond to a valid index in coordinates, and the index set must contain 0 and the last index (one less than endIndex) of coordinates.

    Declaration

    Swift

    @objc open var waypointIndices: IndexSet?