SKRoutingService Class Reference

Inherits from NSObject
Declared in SKRoutingService.h

Overview

SKRoutingService provides services for calculating routes and navigation.

Other Methods

  routingDelegate

The delegate that must conform to SKRoutingDelegate protocol, used for receiving route calculation callbacks.

@property (nonatomic, weak, nullable) id<SKRoutingDelegate> routingDelegate

Discussion

The delegate that must conform to SKRoutingDelegate protocol, used for receiving route calculation callbacks.

Declared In

SKRoutingService.h

  navigationDelegate

The delegate that must conform to SKNavigationDelegate protocol, used for receiving navigation callbacks.

@property (nonatomic, weak, nullable) id<SKNavigationDelegate> navigationDelegate

Discussion

The delegate that must conform to SKNavigationDelegate protocol, used for receiving navigation callbacks.

Declared In

SKRoutingService.h

  mapView

The map view where the calculated routes and the navigation will be displayed.

@property (nonatomic, weak, nullable) SKMapView *mapView

Discussion

The map view where the calculated routes and the navigation will be displayed.

Declared In

SKRoutingService.h

  mainRouteId

The unique identifier of the main route. Main route will be used if a turn by turn navigation is started and will be rendered differently than alternatives.

@property (nonatomic, assign) SKRouteID mainRouteId

Discussion

The unique identifier of the main route. Main route will be used if a turn by turn navigation is started and will be rendered differently than alternatives.

Declared In

SKRoutingService.h

  advisorConfigurationSettings

Manages the audio advisor configuration settings.

@property (nonatomic, strong) SKAdvisorSettings *advisorConfigurationSettings

Discussion

Manages the audio advisor configuration settings.

Declared In

SKRoutingService.h

  visualAdviceConfigurations

An array of SKVisualAdviceConfiguration objects used for configuring the color of the advisor images in different countries and streets.

@property (nonatomic, strong) NSArray<SKVisualAdviceConfiguration*> *visualAdviceConfigurations

Discussion

An array of SKVisualAdviceConfiguration objects used for configuring the color of the advisor images in different countries and streets.

Declared In

SKRoutingService.h

+ sharedInstance

Returns the singleton instance of the SKRoutingService class.

+ (instancetype)sharedInstance

Discussion

Returns the singleton instance of the SKRoutingService class.

Declared In

SKRoutingService.h

– calculateRoute:

Starts route calculations. The routingDelegate will receive calculation status notifications.

- (void)calculateRoute:(SKRouteSettings *)route

Parameters

route

Stores route calculation settings.

Discussion

Starts route calculations. The routingDelegate will receive calculation status notifications.

Declared In

SKRoutingService.h

– zoomToRouteWithInsets:duration:

Zooms the map to the last calculated route.

- (void)zoomToRouteWithInsets:(UIEdgeInsets)insets duration:(NSInteger)duration

Parameters

insets

Contains information about the zooming insets for the route overview.

duration

The duration of the animation in miliseconds. No animation will be performed if the value of this parameter is 0.

Discussion

Zooms the map to the last calculated route.

Declared In

SKRoutingService.h

– zoomToAllRoutesWithInsets:duration:

Zooms the map so that all calculated routes are visible.

- (void)zoomToAllRoutesWithInsets:(UIEdgeInsets)insets duration:(NSInteger)duration

Parameters

insets

Contains information about the zooming insets for the route overview.

duration

The duration of the animation in miliseconds. No animation will be performed if the value of this parameter is 0.

Discussion

Zooms the map so that all calculated routes are visible.

Declared In

SKRoutingService.h

– clearCurrentRoutes

Clears the current routes, including alternatives. Route calculations in progress will also be canceled.

- (void)clearCurrentRoutes

Discussion

Clears the current routes, including alternatives. Route calculations in progress will also be canceled.

Declared In

SKRoutingService.h

– clearRouteAlternatives

Clears the route alternatives, keeping the main one.

- (void)clearRouteAlternatives

Discussion

Clears the route alternatives, keeping the main one.

Declared In

SKRoutingService.h

– routeCoordinatesForRouteWithId:

Returns the array of coordinates for the current route. In order for ‘elevation’ property of returned results to be accurate, requestExtendedRoutePointsInfo of the SKRouteSettings must be set to YES.

- (NSArray<CLLocation*> *)routeCoordinatesForRouteWithId:(NSInteger)routeId

Parameters

routeId

The identifier of the route which can be obtained from the returned SKRouteInformation.

Return Value

The array of route coordinates ( CLLocation objects ), including altitude, if available.

Discussion

Returns the array of coordinates for the current route. In order for ‘elevation’ property of returned results to be accurate, requestExtendedRoutePointsInfo of the SKRouteSettings must be set to YES.

Declared In

SKRoutingService.h

– routeTurningPointsAsGPSPointsForRouteWithId:

Returns the array of turning points as GPS points for the route identified by its unique ID.

- (NSArray<CLLocation*> *)routeTurningPointsAsGPSPointsForRouteWithId:(NSInteger)routeId

Parameters

routeId

The identifier of the route which can be obtained from the returned SKRouteInformation.

Return Value

The array of route coordinates ( CLLocation objects ).

Discussion

Returns the array of turning points as GPS points for the route identified by its unique ID.

Declared In

SKRoutingService.h

– routeTurningPointsAsGPSPoints

Returns the array of turning points as GPS points for the current route.

- (NSArray<CLLocation*> *)routeTurningPointsAsGPSPoints

Return Value

The array of route coordinates ( CLLocation objects ).

Discussion

Returns the array of turning points as GPS points for the current route.

Declared In

SKRoutingService.h

– routeTurningPointsAsMercatorPointsForRouteWithId:

Returns the array of turning points as Mercator points for the route identified by its unique ID.

- (NSArray<CLLocation*> *)routeTurningPointsAsMercatorPointsForRouteWithId:(NSInteger)routeId

Parameters

routeId

The identifier of the route which can be obtained from the returned SKRouteInformation.

Return Value

The array of route coordinates ( CLLocation objects ).

Discussion

Returns the array of turning points as Mercator points for the route identified by its unique ID.

Declared In

SKRoutingService.h

– routeTurningPointsAsMercatorPoints

Returns the array of turning points as Mercator points for the current route.

- (NSArray<CLLocation*> *)routeTurningPointsAsMercatorPoints

Return Value

The array of route coordinates (CLLocation objects ).

Discussion

Returns the array of turning points as Mercator points for the current route.

Declared In

SKRoutingService.h

– routeCountriesForRouteWithId:

Returns the array of country codes that the route crosses. In order for this to work, requestCountryCodes of the SKRouteSettings must be set to YES.

- (NSArray<NSString*> *)routeCountriesForRouteWithId:(NSInteger)routeId

Parameters

routeId

The identifier of the route which can be obtained from the returned SKRouteInformation.

Return Value

The array of country codes that the route crosses ( NSString objects ).

Discussion

Returns the array of country codes that the route crosses. In order for this to work, requestCountryCodes of the SKRouteSettings must be set to YES.

Declared In

SKRoutingService.h

– routeAdviceListWithDistanceFormat:

Returns the array of advices for the current route. In order for this to work, requestAdvices of the SKRouteSettings must be set to YES.

- (NSArray<SKRouteAdvice*> *)routeAdviceListWithDistanceFormat:(SKDistanceFormat)distanceFormat

Parameters

distanceFormat

The measurment unit of the distance. By default is set SKDistanceFormatMetric.

Return Value

The array of advices ( SKRouteAdvice objects ).

Discussion

Returns the array of advices for the current route. In order for this to work, requestAdvices of the SKRouteSettings must be set to YES.

Declared In

SKRoutingService.h

– visualAdviceImageForRouteAdvice:color:

Generates and returns an image about the visual advice using the given configuration.

- (nullable UIImage *)visualAdviceImageForRouteAdvice:(SKRouteAdvice *)routeAdvice color:(SKVisualAdviceConfiguration *)visualAdviceColor

Parameters

routeAdvice

Contains all the information about an advice.

visualAdviceColor

The SKVisualAdviceConfiguration is used to store the colors of a generated visual advice image.

Return Value

An image about the advice.

Discussion

Generates and returns an image about the visual advice using the given configuration.

Declared In

SKRoutingService.h

– startRouteFromGPXFile:

Converts the main component of a GPX file into a route.

- (void)startRouteFromGPXFile:(NSString *)path

Parameters

path

The path to the GPX file.

Discussion

Converts the main component of a GPX file into a route.

Declared In

SKRoutingService.h

– startNavigationWithSettings:

Starts the navigation. If a route is already calculated, it will be used for turn by turn navigation, otherwise a free drive session will begin. In order to receive navigation updates, use the navigationDelegate.

- (BOOL)startNavigationWithSettings:(SKNavigationSettings *)navigationSettings

Parameters

navigationSettings

The settings of the navigation. For more info, visit the SKNavigationSettings documentation. If nil, default settings will be used.

Return Value

Success/failure of starting the navigation.

Discussion

Starts the navigation. If a route is already calculated, it will be used for turn by turn navigation, otherwise a free drive session will begin. In order to receive navigation updates, use the navigationDelegate.

Declared In

SKRoutingService.h

– stopNavigation

Stops the current navigation session.

- (void)stopNavigation

Discussion

Stops the current navigation session.

Declared In

SKRoutingService.h

– blockRoads:

Signals that the road ahead is blocked at a given distance. Blocking the road will trigger a rerouting, in navigation mode and the recalculation of the current route, in map mode.

- (void)blockRoads:(double)distance

Parameters

distance

Distance to the block from the current position or from the start point, in meters.

Discussion

Signals that the road ahead is blocked at a given distance. Blocking the road will trigger a rerouting, in navigation mode and the recalculation of the current route, in map mode.

Declared In

SKRoutingService.h

– unBlockAllRoads:

Signals that the road ahead has been unblocked. In navigation mode unblocks all previously blocked roads and causes a rerouting. In map mode unblocks all previously blocked roads and relaunches the calculation of the current route.

- (void)unBlockAllRoads:(BOOL)reroute

Parameters

reroute

If set to YES, a rerouting is triggered after unblocking the road.

Discussion

Signals that the road ahead has been unblocked. In navigation mode unblocks all previously blocked roads and causes a rerouting. In map mode unblocks all previously blocked roads and relaunches the calculation of the current route.

Declared In

SKRoutingService.h

– addViaPoint:afterViaPointWithID:

Adds a viapoint to an already existing route. After using calculateRoute, further viapoints can be added to the route (viaPoints array from SKRouteSettings contains the predefined route viapoint). Adding a viapoint in navigation mode triggers a re-routing, in map mode triggers the re-calculation of the current route.

- (void)addViaPoint:(SKViaPoint *)viaPoint afterViaPointWithID:(NSInteger)viaPointID

Parameters

viaPoint

Stores the information about the viapoint.

viaPointID

Identifies the via point after which the new via point is inserted. -1 should be used to insert the new viapoint to the beginning of the viapoint list.

Discussion

Adds a viapoint to an already existing route. After using calculateRoute, further viapoints can be added to the route (viaPoints array from SKRouteSettings contains the predefined route viapoint). Adding a viapoint in navigation mode triggers a re-routing, in map mode triggers the re-calculation of the current route.

Declared In

SKRoutingService.h

– removeViaPointWithIdentifier:

Removes the viapoint (identified with viaPointID). After using calculateRoute, predefined viapoints can be removed from the route (viaPoints array from SKRouteSettings contains the predefined route viapoint). Removing a viapoint in navigation mode triggers a re-routing, in map mode triggers the re-calculation of the current route.

- (void)removeViaPointWithIdentifier:(NSInteger)viaPointID

Parameters

viaPointID

Identifies the via point.

Discussion

Removes the viapoint (identified with viaPointID). After using calculateRoute, predefined viapoints can be removed from the route (viaPoints array from SKRouteSettings contains the predefined route viapoint). Removing a viapoint in navigation mode triggers a re-routing, in map mode triggers the re-calculation of the current route.

Declared In

SKRoutingService.h

– giveNowSpeedLimitAudioInfo

When called, the current speed limit audio info will be provided, in navigationDelegate’s routingService:didUpdateSpeedWarningToStatus:withAudioWarnings:insideCity: callback.

- (void)giveNowSpeedLimitAudioInfo

Discussion

When called, the current speed limit audio info will be provided, in navigationDelegate’s routingService:didUpdateSpeedWarningToStatus:withAudioWarnings:insideCity: callback.

Declared In

SKRoutingService.h

– changeNavigationSettings:

Modifies the configurations of a navigation.

- (void)changeNavigationSettings:(SKNavigationSettings *)navigationSettings

Parameters

navigationSettings

stores settings for a navigation session.

Discussion

Modifies the configurations of a navigation.

Declared In

SKRoutingService.h

– saveRouteToCache:

Saves the route with a given identifier to the cache. Later this route can be reused without the need to recalculate it. Closing the app will delete the route from the cache, so in the next app start it can’t be reused.

- (BOOL)saveRouteToCache:(SKRouteID)routeId

Parameters

routeId

The identifier of the route from the returned SKRouteInformation.

Return Value

Success/Failure of caching a route.

Discussion

Saves the route with a given identifier to the cache. Later this route can be reused without the need to recalculate it. Closing the app will delete the route from the cache, so in the next app start it can’t be reused.

Declared In

SKRoutingService.h

– removeRouteFromCache:

Removes the route with a given identifier from the cache.

- (void)removeRouteFromCache:(SKRouteID)routeId

Parameters

routeId

The identifier of the route.

Discussion

Removes the route with a given identifier from the cache.

Declared In

SKRoutingService.h

– clearAllRoutesFromCache

Removes all the cached routes.

- (void)clearAllRoutesFromCache

Discussion

Removes all the cached routes.

Declared In

SKRoutingService.h

– loadRouteFromCache:

Loads the route with a given identifier from the cache, without recalculating it.

- (void)loadRouteFromCache:(SKRouteID)routeId

Parameters

routeId

The identifier of the route.

Discussion

Loads the route with a given identifier from the cache, without recalculating it.

Declared In

SKRoutingService.h

– rerouteFromLastMatchedPosition

Starts rerouting from the last matched position. Use this when the route is calculated using a GPX file and a rerouting is needed for navigating on the GPX route from current position.

- (void)rerouteFromLastMatchedPosition

Discussion

Starts rerouting from the last matched position. Use this when the route is calculated using a GPX file and a rerouting is needed for navigating on the GPX route from current position.

Declared In

SKRoutingService.h

GPSFiles Methods

– calculateRouteWithSettings:GPSFileElement:

Starts a route calculation, based on a SKGPSFileElement. The routingDelegate will receive calculation status notifications.

- (void)calculateRouteWithSettings:(SKRouteSettings *)route GPSFileElement:(SKGPSFileElement *)element

Parameters

route

The settings for calculating the route. Some setting won’t be used in this case, such as start and destination coordinate, because the geometry from the SKGPSFileElement will be used.

element

The SKGPSFileElement, result of parsing a GPS file using the SKGPSFilesService class.

Discussion

Starts a route calculation, based on a SKGPSFileElement. The routingDelegate will receive calculation status notifications.

Declared In

SKRoutingService+GPSFiles.h

– calculateRouteWithSettings:customLocations:

Starts a route calculation, based on a predefined array of coordinates. The routingDelegate will receive calculation status notifications.

- (void)calculateRouteWithSettings:(SKRouteSettings *)route customLocations:(NSArray<CLLocation*> *)locations

Parameters

route

The settings for calculating the route. Some setting won’t be used in this case, such as start and destination coordinate, since the route locations are predefined.

locations

An array of CLLocation objects that define the custom route.

Discussion

Starts a route calculation, based on a predefined array of coordinates. The routingDelegate will receive calculation status notifications.

Declared In

SKRoutingService+GPSFiles.h