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: ProfileIdentifier? = nil, queryItems: [URLQueryItem]? = nil)
Parameters
locations
An array of
CLLocation
objects representing locations to attempt to match against the road network. The array should contain at least two locations (the source and destination) and at most 100 locations. (Some profiles, such asProfileIdentifier.automobileAvoidingTraffic
, may have lower limits.)profileIdentifier
A string specifying the primary mode of transportation for the routes.
ProfileIdentifier.automobile
is used by default.queryItems
URL query items to be parsed and applied as configuration to the resulting options.
-
Initializes a match options object for matching geographic coordinates against the road network.
Declaration
Swift
public convenience init(coordinates: [LocationCoordinate2D], profileIdentifier: ProfileIdentifier? = nil, queryItems: [URLQueryItem]? = nil)
Parameters
coordinates
An array of geographic coordinates representing locations to attempt to match against the road network. The array should contain at least two locations (the source and destination) and at most 100 locations. (Some profiles, such as
ProfileIdentifier.automobileAvoidingTraffic
, may have lower limits.) Each coordinate is converted into aWaypoint
object.profileIdentifier
A string specifying the primary mode of transportation for the routes.
ProfileIdentifier.automobile
is used by default.queryItems
URL query items to be parsed and applied as configuration to the resulting options.
-
Declaration
Swift
public required init(waypoints: [Waypoint], profileIdentifier: ProfileIdentifier? = nil, queryItems: [URLQueryItem]? = nil)
-
If true, the input locations are re-sampled for improved map matching results. The default is
false
.Declaration
Swift
open var resamplesTraces: Bool
-
An index set containing indices of two or more items in
coordinates
. These will be represented byWaypoint
s in the resultingMatch
objects.Use this property when the
DirectionsOptions.includesSteps
property istrue
or whencoordinates
represents a trace with a high sample rate. If this property isnil
, the resultingMatch
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 thanendIndex
) ofcoordinates
.Declaration
Swift
@available(*, deprecated, message: "Use Waypoint.separatesLegs instead.") open var waypointIndices: IndexSet?
-
Declaration
Swift
override open var urlQueryItems: [URLQueryItem] { get }