TrafficEngine

public class TrafficEngine
extension TrafficEngine: NativeBase
extension TrafficEngine: Hashable

Use the TrafficEngine to get information about current traffic flow and incidents in an area specified by GeoBox, GeoCircle, or GeoCorridor. Provides optional parameters given in TrafficIncidentsQueryOptions and TrafficFlowQueryOptions to filter the result.

By default, incidents are localized based on their geographical location. You can override that behavior by specifying the desired language that should be used for the incidents description and summary.

The resulting traffic data contains information on incident types such as congestion, construction for road works, road hazard, road closure, weather updates for road condition, lane restriction and others.

Traffic data is fetched online to get the most precise and freshest data available. In offline mode, live traffic data can be fetched using the traffic pass-through features. See SDKNativeEngine.passThroughFeatures

  • Creates a new instance of this class.

    Throws

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init() throws
  • Creates a new instance of this class.

    Throws

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init(_ sdkEngine: SDKNativeEngine) throws

    Parameters

    sdkEngine

    An SDKEngine instance.

  • Asynchronously queries for traffic incidents using a bounding box as a filter.

    Declaration

    Swift

    @discardableResult
    public func queryForIncidents(inside boxArea: GeoBox, queryOptions: TrafficIncidentsQueryOptions, completion: @escaping TrafficIncidentsQueryCompletionHandler) -> TaskHandle

    Parameters

    boxArea

    The bounding box area to search for traffic incidents. The maximum width and height for a bounding box filter is 1 degree.

    queryOptions

    The options which are specific for incidents query.

    completion

    It is always invoked on the main thread.

    Return Value

    Handle that will be used to manipulate the execution of the task.

  • Asynchronously queries for traffic incidents using a circle as a filter.

    Declaration

    Swift

    @discardableResult
    public func queryForIncidents(inside circleArea: GeoCircle, queryOptions: TrafficIncidentsQueryOptions, completion: @escaping TrafficIncidentsQueryCompletionHandler) -> TaskHandle

    Parameters

    circleArea

    The circle area to search for traffic incidents. The maximum radius of the circle filter is 50000 meters.

    queryOptions

    The options which are specific for incidents query.

    completion

    It is always invoked on the main thread.

    Return Value

    Handle that will be used to manipulate the execution of the task.

  • Asynchronously queries for traffic incidents by a corridor as a filter.

    Declaration

    Swift

    @discardableResult
    public func queryForIncidents(inside corridorArea: GeoCorridor, queryOptions: TrafficIncidentsQueryOptions, completion: @escaping TrafficIncidentsQueryCompletionHandler) -> TaskHandle

    Parameters

    corridorArea

    The corridor box to search for traffic incidents. The maximum length for the corridor is 500000 meters and the maximum GeoCorridor.half_width_in_meters is 5000 meters. If no GeoCorridor.half_width_in_meters is specified, the default value is used. The default value is 30 meters.

    queryOptions

    The options which are specific for incidents query.

    completion

    It is always invoked on the main thread.

    Return Value

    Handle that will be used to manipulate the execution of the task.

  • Asynchronously queries for traffic incident by the original id. See TrafficIncident.originalId for more information.

    Declaration

    Swift

    @discardableResult
    public func lookupIncident(with originalId: String, lookupOptions: TrafficIncidentLookupOptions, completion: @escaping TrafficIncidentCompletionHandler) -> TaskHandle

    Parameters

    originalId

    The requested incident original id.

    lookupOptions

    The options which are specific for the incident lookup query.

    completion

    The callback object that will be invoked after the incident lookup query. It is always invoked on the main thread.

    Return Value

    Handle that will be used to manipulate the execution of the task.

  • Asynchronously queries for traffic flow using a bounding box as a filter.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    @discardableResult
    public func queryForFlow(inside boxArea: GeoBox, queryOptions: TrafficFlowQueryOptions, completion: @escaping TrafficFlowQueryCompletionHandler) -> TaskHandle

    Parameters

    boxArea

    The bounding box area to search for traffic flow.

    queryOptions

    The options which are specific for flow query.

    completion

    It is always invoked on the main thread.

    Return Value

    Handle that will be used to manipulate the execution of the task.

  • Asynchronously queries for traffic flow using a circle as a filter.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    @discardableResult
    public func queryForFlow(inside circleArea: GeoCircle, queryOptions: TrafficFlowQueryOptions, completion: @escaping TrafficFlowQueryCompletionHandler) -> TaskHandle

    Parameters

    circleArea

    The circle area to search for traffic flow. The maximum radius of the circle filter is 50000 meters.

    queryOptions

    The options which are specific for flow query.

    completion

    It is always invoked on the main thread.

    Return Value

    Handle that will be used to manipulate the execution of the task.

  • Asynchronously queries for traffic flow by a corridor as a filter.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    @discardableResult
    public func queryForFlow(inside corridorArea: GeoCorridor, queryOptions: TrafficFlowQueryOptions, completion: @escaping TrafficFlowQueryCompletionHandler) -> TaskHandle

    Parameters

    corridorArea

    The corridor box to search for traffic flow. The maximum length for the corridor is 500000 meters and the maximum GeoCorridor.half_width_in_meters is 5000 meters. If no GeoCorridor.half_width_in_meters is specified, the default value is used. The default value is 30 meters.

    queryOptions

    The options which are specific for flow query.

    completion

    It is always invoked on the main thread.

    Return Value

    Handle that will be used to manipulate the execution of the task.