Match
open class Match: DirectionsResult
A Match
object defines a single route that was created from a series of points that were matched against a road network.
Typically, you do not create instances of this class directly. Instead, you receive match objects when you pass a MatchOptions
object into the Directions.calculate(_:completionHandler:)
or Directions.calculateRoutes(matching:completionHandler:)
method.
-
Initializes a new match object with the given JSON dictionary representation and tracepoints.
Declaration
Swift
@objc public convenience init(json: [String: Any], tracepoints: [Tracepoint], waypointIndices: IndexSet, matchOptions: MatchOptions)
Parameters
json
A JSON dictionary representation of the route as returned by the Mapbox Map Matching API.
tracepoints
An array of
Tracepoint
that the match found in order.matchOptions
The
MatchOptions
used to create the request. -
A number between 0 and 1 that indicates the Map Matching API’s confidence that the match is accurate. A higher confidence means the match is more likely to be accurate.
Declaration
Swift
@objc open var confidence: Float
-
Tracepoints on the road network that match the tracepoints in the match options.
Any outlier tracepoint is omitted from the match. This array represents an outlier tracepoint is a
Tracepoint
object whoseTracepoint.coordinate
property iskCLLocationCoordinate2DInvalid
.Declaration
Swift
@objc open var tracepoints: [Tracepoint]
-
Index of the waypoint inside the matched route.
Declaration
Swift
@objc open var waypointIndices: IndexSet?
-
MatchOptions
used to create the match request.Declaration
Swift
public var matchOptions: MatchOptions