View Full Version : ViaPoints Way point Questions

05.02.2016, 01:09
I have questions regarding skmap sdk functionality.

After creating a route and starting the navigation process, is there anyway of capturing the waypoint/viapoint that you are currently directed towards? After calculating a route, it seems routeInformation.viaPointsOnRoute is empty. Does calculateRoute(route) automatically generate a list of viaPoints? In the SKNavigationDelegate Protocol Reference I see the following event functions :

– routingService:didEnterViaPointArea:
– routingService:didReachViaPointWithIndex:
– routingService:didExitViaPointArea:

However, these methods never seem to be called. Not sure if they are only called if ViaPoints are programmatically added.

Also when the routeService fires the currentAdvice and nextAdvice methods, the SKRouteAvice location appear to be empty as well.

Is there anyway someone could provide me with a simple example of how to create and capture the current waypoint position and the next waypoint position while in navigation? Essentially, I am trying to calculate the direction from the current location to the next waypoint.

Below is rough example of my route and navigation initiation code:

//Created Route
let route: SKRouteSettings = SKRouteSettings()
route.routeMode = SKRouteMode.Pedestrian
route.startCoordinate = coordinateCurrent!
route.destinationCoordinate = coordinateDestination!
route.shouldBeRendered = true
SKRoutingService.sharedInstance().calculateRoute(r oute)

//Start Navigation
let navSettings: SKNavigationSettings = SKNavigationSettings()
navSettings.navigationType = SKNavigationType.Simulation
navSettings.distanceFormat = SKDistanceFormat.MilesFeet
self.mapView!.settings.displayMode = SKMapDisplayMode.Mode3D
navSettings.transportMode = SKTransportMode.Pedestrian
SKRoutingService.sharedInstance().startNavigationW ithSettings(navSettings)

//Start Postioner Service
SKPositionerService.sharedInstance().delegate = self
SKPositionerService.sharedInstance().startLocation Update()

func routingService(routingService: SKRoutingService!, didChangeNextAdvice nextAdvice: SKRouteAdvice, isLastAdvice:Bool)

func routingService(routingService: SKRoutingService!, didChangeCurrentAdvice currentAdvice: SKRouteAdvice, isLastAdvice:Bool)

func routingService(routingService: SKRoutingService!,
didUpdateViaPointsInformation viaPoints: [AnyObject]!)
log("VIA INFO: " + String(viaPoints))

func routingService(routingService: SKRoutingService!,
didEnterViaPointArea index: Int32)
log("ENTER VIA: " + String(index))

func routingService(routingService: SKRoutingService!,
didExitViaPointArea index: Int32)
log("EXIT VIA: " + String(index))

Thank you for your time!