Intersection

public struct Intersection : ForeignMemberContainer
extension Intersection: Codable
extension Intersection: Equatable

A single cross street along a step.

  • Initializes an intersection.

    Declaration

    Swift

    public init(location: LocationCoordinate2D,
                headings: [LocationDirection],
                approachIndex: Int,
                outletIndex: Int,
                outletIndexes: IndexSet,
                approachLanes: [LaneIndication]?,
                usableApproachLanes: IndexSet?,
                preferredApproachLanes: IndexSet?,
                laneValidIndications: [ManeuverDirection?]? = nil,
                outletRoadClasses: RoadClasses? = nil,
                tollCollection: TollCollection? = nil,
                tunnelName: String? = nil,
                restStop: RestStop? = nil,
                isUrban: Bool? = nil,
                regionCode: String? = nil,
                outletMapboxStreetsRoadClass: MapboxStreetsRoadClass? = nil,
                railroadCrossing: Bool? = nil,
                trafficSignal: Bool? = nil,
                stopSign: Bool? = nil,
                yieldSign: Bool? = nil,
                interchange: Interchange? = nil,
                junction: Junction? = nil)

    Parameters

    location

    The geographic coordinates at the center of the intersection.

    headings

    The absolute headings of the roads that meet at the intersection.

    approachIndex

    The index of the item in headings that corresponds to the road used to approach the intersection.

    outletIndex

    The index of the item in headings that corresponds to the road used to leave the intersection.

    outletIndexes

    The indices of the items in headings that correspond to the roads that may be used to leave the intersection.

    approachLanes

    All the lanes of the road used to approach the intersection.

    usableApproachLanes

    The indices of the items in approachLanes that correspond to the lanes that may be used to execute the maneuver.

    preferredApproachLanes

    The indices of the items in approachLanes that correspond to the lanes that are preferred to execute the maneuver.

    laneValidIndications

    For each item in approachLanes, the indication that is applicable to the current route, or nil for a lane that has no applicable indication.

    outletRoadClasses

    The road classes of the road used to leave the intersection.

    tollCollection

    The toll collection point at the intersection.

    tunnelName

    The name of the tunnel that the intersection is a part of.

    restStop

    The rest stop at the intersection.

    isUrban

    Whether the intersection lies within the bounds of an urban zone.

    regionCode

    A 2-letter region code identifying the country that the intersection lies in.

    outletMapboxStreetsRoadClass

    The Mapbox Streets road class of the road used to leave the intersection.

    railroadCrossing

    Whether there is a railroad crossing at the intersection.

    trafficSignal

    Whether there is a traffic signal at the intersection.

    stopSign

    Whether there is a stop sign at the intersection.

    yieldSign

    Whether there is a yield sign at the intersection.

    interchange

    Information about routing and passing an interchange along the route.

    junction

    Information about routing and passing a junction along the route.

  • Initializes an intersection whose lanes all share a single applicable maneuver direction.

    Lanes at the same intersection may legitimately have differing applicable maneuver directions, which a single usableLaneIndication cannot represent. Use init(location:headings:approachIndex:outletIndex:outletIndexes:approachLanes:usableApproachLanes:preferredApproachLanes:laneValidIndications:…) instead, passing one indication per lane.

    Declaration

    Swift

    @available(*, deprecated, message: "Use the initializer that takes laneValidIndications, which reflects that lanes may have differing indications.")
    public init(location: LocationCoordinate2D,
                headings: [LocationDirection],
                approachIndex: Int,
                outletIndex: Int,
                outletIndexes: IndexSet,
                approachLanes: [LaneIndication]?,
                usableApproachLanes: IndexSet?,
                preferredApproachLanes: IndexSet?,
                usableLaneIndication: ManeuverDirection?,
                outletRoadClasses: RoadClasses? = nil,
                tollCollection: TollCollection? = nil,
                tunnelName: String? = nil,
                restStop: RestStop? = nil,
                isUrban: Bool? = nil,
                regionCode: String? = nil,
                outletMapboxStreetsRoadClass: MapboxStreetsRoadClass? = nil,
                railroadCrossing: Bool? = nil,
                trafficSignal: Bool? = nil,
                stopSign: Bool? = nil,
                yieldSign: Bool? = nil,
                interchange: Interchange? = nil,
                junction: Junction? = nil)

    Parameters

    location

    The geographic coordinates at the center of the intersection.

    headings

    The absolute headings of the roads that meet at the intersection.

    approachIndex

    The index of the item in headings that corresponds to the road used to approach the intersection.

    outletIndex

    The index of the item in headings that corresponds to the road used to leave the intersection.

    outletIndexes

    The indices of the items in headings that correspond to the roads that may be used to leave the intersection.

    approachLanes

    All the lanes of the road used to approach the intersection.

    usableApproachLanes

    The indices of the items in approachLanes that correspond to the lanes that may be used to execute the maneuver.

    preferredApproachLanes

    The indices of the items in approachLanes that correspond to the lanes that are preferred to execute the maneuver.

    usableLaneIndication

    The indication that is applicable to the current route, shared by every lane that may be used to execute the maneuver.

    outletRoadClasses

    The road classes of the road used to leave the intersection.

    tollCollection

    The toll collection point at the intersection.

    tunnelName

    The name of the tunnel that the intersection is a part of.

    restStop

    The rest stop at the intersection.

    isUrban

    Whether the intersection lies within the bounds of an urban zone.

    regionCode

    A 2-letter region code identifying the country that the intersection lies in.

    outletMapboxStreetsRoadClass

    The Mapbox Streets road class of the road used to leave the intersection.

    railroadCrossing

    Whether there is a railroad crossing at the intersection.

    trafficSignal

    Whether there is a traffic signal at the intersection.

    stopSign

    Whether there is a stop sign at the intersection.

    yieldSign

    Whether there is a yield sign at the intersection.

    interchange

    Information about routing and passing an interchange along the route.

    junction

    Information about routing and passing a junction along the route.

  • An array of LocationDirections indicating the absolute headings of the roads that meet at the intersection.

    A road is represented in this array by a heading indicating the direction from which the road meets the intersection. To get the direction of travel when leaving the intersection along the road, rotate the heading 180 degrees.

    A single road that passes through this intersection is represented by two items in this array: one for the segment that enters the intersection and one for the segment that exits it.

    Declaration

    Swift

    public let headings: [LocationDirection]
  • The indices of the items in the headings array that correspond to the roads that may be used to leave the intersection.

    This index set effectively excludes any one-way road that leads toward the intersection.

    Declaration

    Swift

    public let outletIndexes: IndexSet
  • The index of the item in the headings array that corresponds to the road that the containing route step uses to approach the intersection.

    This property is set to nil for a departure maneuver.

    Declaration

    Swift

    public let approachIndex: Int?
  • The index of the item in the headings array that corresponds to the road that the containing route step uses to leave the intersection.

    This property is set to nil for an arrival maneuver.

    Declaration

    Swift

    public let outletIndex: Int?
  • The road classes of the road that the containing step uses to leave the intersection.

    If road class information is unavailable, this property is set to nil.

    Declaration

    Swift

    public let outletRoadClasses: RoadClasses?
  • The road classes of the road that the containing step uses to leave the intersection, according to the Mapbox Streets source , version 8.

    If detailed road class information is unavailable, this property is set to nil. This property only indicates the road classification; for other aspects of the road, use the outletRoadClasses property.

    Declaration

    Swift

    public let outletMapboxStreetsRoadClass: MapboxStreetsRoadClass?
  • The name of the tunnel that this intersection is a part of.

    If this Intersection is not a tunnel entrance or exit, or if information is unavailable then this property is set to nil.

    Declaration

    Swift

    public let tunnelName: String?
  • A toll collection point.

    If this Intersection is not a toll collection intersection, or if this information is unavailable then this property is set to nil.

    Declaration

    Swift

    public let tollCollection: TollCollection?
  • Corresponding rest stop.

    If this Intersection is not a rest stop, or if this information is unavailable then this property is set to nil.

    Declaration

    Swift

    public let restStop: RestStop?
  • Whether the intersection lays within the bounds of an urban zone.

    If this information is unavailable, then this property is set to nil.

    Declaration

    Swift

    public let isUrban: Bool?
  • A 2-letter region code to identify corresponding country that this intersection lies in.

    Automatically populated during decoding a RouteLeg object, since this is the source of all AdministrativeRegions. Value is nil if such information is unavailable.

    Seealso

    RouteStep.regionCode(atStepIndex:, intersectionIndex:)

    Declaration

    Swift

    public private(set) var regionCode: String? { get }
  • All the lanes of the road that the containing route step uses to approach the intersection. Each item in the array represents a lane, which is represented by one or more LaneIndications.

    If no lane information is available for the intersection, this property’s value is nil. The first item corresponds to the leftmost lane, the second item corresponds to the second lane from the left, and so on, regardless of whether the surrounding country drives on the left or on the right.

    Declaration

    Swift

    public let approachLanes: [LaneIndication]?
  • The indices of the items in the approachLanes array that correspond to the lanes that may be used to execute the maneuver.

    If no lane information is available for an intersection, this property’s value is nil.

    Declaration

    Swift

    public let usableApproachLanes: IndexSet?
  • The indices of the items in the approachLanes array that correspond to the lanes that are preferred to execute the maneuver.

    If no lane information is available for an intersection, this property’s value is nil.

    Declaration

    Swift

    public let preferredApproachLanes: IndexSet?
  • For each item in the approachLanes array, which of its LaneIndications is applicable to the current route when there is more than one.

    A lane’s entry is nil if the lane has no applicable indication. Lanes at the same intersection may have differing entries: for example, one lane may indicate a straight maneuver while an adjacent lane indicates a slight turn, if both lanes can be used to execute the maneuver.

    If no lane information is available for the intersection, this property’s value is nil.

    Declaration

    Swift

    public let laneValidIndications: [ManeuverDirection?]?
  • Which of the LaneIndications is applicable to the current route when there is more than one.

    If no lane information is available for the intersection, this property’s value is nil

    Note

    Lanes at the same intersection may legitimately have differing applicable indications, in which case this property collapses them to a single value, preferring the indication of a preferred lane, then that of a usable lane, then that of the first lane. Use laneValidIndications instead to get every lane’s own indication.

    Declaration

    Swift

    @available(*, deprecated, message: "Use laneValidIndications, which reflects that lanes may have differing indications.")
    public var usableLaneIndication: ManeuverDirection? { get }
  • Indicates whether there is a railroad crossing at the intersection.

    If such information is not available for an intersection, this property’s value is nil.

    Declaration

    Swift

    public let railroadCrossing: Bool?
  • Indicates whether there is a traffic signal at the intersection.

    If such information is not available for an intersection, this property’s value is nil.

    Declaration

    Swift

    public let trafficSignal: Bool?
  • Indicates whether there is a stop sign at the intersection.

    If such information is not available for an intersection, this property’s value is nil.

    Declaration

    Swift

    public let stopSign: Bool?
  • Indicates whether there is a yield sign at the intersection.

    If such information is not available for an intersection, this property’s value is nil.

    Declaration

    Swift

    public let yieldSign: Bool?
  • An object containing information about routing and passing interchange along the route. If such information is not available for an intersection, this property’s value is nil.

    Declaration

    Swift

    public let interchange: Interchange?
  • An object containing information about routing and passing junction along the route. If such information is not available for an intersection, this property’s value is nil.

    Declaration

    Swift

    public let junction: Junction?
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Declaration

    Swift

    public static func == (lhs: Intersection, rhs: Intersection) -> Bool