RoadGraph
public final class RoadGraph
RoadGraph
provides methods to get edge shape (e.g. RoadGraph.Edge
) and metadata.
You do not create a RoadGraph
object manually. Instead, observe the Notification.Name.electronicHorizonDidUpdatePosition
notification to obtain edge identifiers and get more details about the edges using the RouteController.roadGraph
or PassiveLocationManager.roadGraph
property.
Note
The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of the level of use of the feature.-
Returns metadata about the edge with the given edge identifier.
Return Value
Metadata about the edge with the given edge identifier, or
nil
if the edge is not in the cache. -
Returns a line string geometry corresponding to the given edge identifier.
Declaration
Swift
public func edgeShape(edgeIdentifier: Edge.Identifier) -> LineString?
Return Value
A line string corresponding to the given edge identifier, or
nil
if the edge is not in the cache.
-
Returns a line string geometry corresponding to the given path.
Declaration
Swift
public func shape(of path: Path) -> LineString?
Return Value
A line string corresponding to the given path, or
nil
if any of path edges are not in the cache. -
Returns a point corresponding to the given position.
Declaration
Swift
public func shape(of position: Position) -> Point?
Return Value
A point corresponding to the given position, or
nil
if the edge is not in the cache.
-
Keys in the user info dictionaries of various notifications posted by instances of
See moreRouteController
orPassiveLocationManager
aboutRoadGraph
s.Declaration
Swift
public struct NotificationUserInfoKey : Hashable, Equatable, RawRepresentable
-
An edge in a routing graph. For example, an edge may represent a road segment between two intersections or between the two ends of a bridge. An edge may traverse multiple road objects, and a road object may be associated with multiple edges.
An electronic horizon is a probable path (or paths) of a vehicle. The road network ahead of the user is represented as a tree of edges. Each intersection has outlet edges. In turn, each edge has a probability of transition to another edge, as well as details about the road segment that the edge traverses. You can use these details to influence application behavior based on predicted upcoming conditions.
During active turn-by-turn navigation, the user-selected route and its metadata influence the path of the electronic horizon determined by
RouteController
. During passive navigation (free-driving), no route is actively selected, soPassiveLocationManager
will determine the most probable path from the vehicle’s current location. You can receive notifications about changes in the current state of the electronic horizon by observing theNotification.Name.electronicHorizonDidUpdatePosition
,Notification.Name.electronicHorizonDidEnterRoadObject
, andNotification.Name.electronicHorizonDidExitRoadObject
notifications.Use a
RoadGraph
object to get an edge with a given identifier.Note
The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of the level of use of the feature.Declaration
Swift
public struct Edge
-
A position along a linear object in the road graph.
See more- note: The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of the level of use of the feature.
Declaration
Swift
public struct Path
-
The position of a point object in the road graph.
See more- note: The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of the level of use of the feature.
Declaration
Swift
public struct Position
-
The
SubgraphEdge
represents an edge in the complex object which might be considered as a directed graph. The graph might contain loops.innerEdgeIds
andouterEdgeIds
properties contain edge ids, which allows to traverse the graph, obtain geometry and calculate different distances inside it.Note
The Mapbox Electronic Horizon feature of the Mapbox Navigation SDK is in public beta and is subject to changes, including its pricing. Use of the feature is subject to the beta product restrictions in the Mapbox Terms of Service. Mapbox reserves the right to eliminate any free tier or free evaluation offers at any time and require customers to place an order to purchase the Mapbox Electronic Horizon feature, regardless of the level of use of the feature.Declaration
Swift
public struct SubgraphEdge