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
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init() throws -
Creates a new instance of this class.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init(_ sdkEngine: SDKNativeEngine) throwsParameters
sdkEngineAn 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) -> TaskHandleParameters
boxAreaThe bounding box area to search for traffic incidents. The maximum width and height for a bounding box filter is 1 degree.
queryOptionsThe options which are specific for incidents query.
completionIt 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) -> TaskHandleParameters
circleAreaThe circle area to search for traffic incidents. The maximum radius of the circle filter is 50000 meters.
queryOptionsThe options which are specific for incidents query.
completionIt 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) -> TaskHandleParameters
corridorAreaThe corridor box to search for traffic incidents. The maximum length for the corridor is 500000 meters and the maximum
GeoCorridor.half_width_in_metersis 5000 meters. If the number of points in corridor is greater than 300 then request is split into smaller ones and results are aggregated into single response, this will result in multiple requests to the backend. This process does not change a shape of the corridor.queryOptionsThe options which are specific for incidents query.
completionIt 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.originalIdfor more information.Declaration
Swift
@discardableResult public func lookupIncident(with originalId: String, lookupOptions: TrafficIncidentLookupOptions, completion: @escaping TrafficIncidentCompletionHandler) -> TaskHandleParameters
originalIdThe requested incident original id.
lookupOptionsThe options which are specific for the incident lookup query.
completionThe 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) -> TaskHandleParameters
boxAreaThe bounding box area to search for traffic flow.
queryOptionsThe options which are specific for flow query.
completionIt 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) -> TaskHandleParameters
circleAreaThe circle area to search for traffic flow. The maximum radius of the circle filter is 50000 meters.
queryOptionsThe options which are specific for flow query.
completionIt 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) -> TaskHandleParameters
corridorAreaThe corridor box to search for traffic flow. The maximum length for the corridor is 500000 meters and the maximum
GeoCorridor.half_width_in_metersis 5000 meters.queryOptionsThe options which are specific for flow query.
completionIt is always invoked on the main thread.
Return Value
Handle that will be used to manipulate the execution of the task.