View Full Version : estimatedTime incorrect for route calculated with startRouteFromGPXFile

19.02.2015, 20:21

I've noticed that the estimatedTime for a route calculated with the startRouteFromGPXFile method seems incorrect. For route settings I've tried multiple settings (CarEfficient, CarFastest, CarShortest) but the estimatedTimes are ridiculously high. For example:

Track 1: 129 km - estimatedTime 8:32 (around 15 km/hr), while Garmin Basecamp give me an estimated time of 3:11
Track 2: 241 km - estimatedTime 13:03 (around 19 km/hr), while Garmin Basecamp give me an estimated time of 5:01
Track 3: 244 km - estimatedTime 21:09 (around 12 km/hr), while Garmin Basecamp give me an estimated time of 3:58
Track 4: 362 km - estimatedTime 26:48 (around 14 km/hr), while Garmin Basecamp give me an estimated time of 5:56

Looking at the speeds I could assume that the estimatedTime is always calculated using one of the Bicycle routeMode's. Don't know if that's the case?
Is there a setting somewhere to change how the estimatedTime is calculated?

20.02.2015, 14:03
Could you add the full code you use for creating the route along with a link to the GPX tracks you are using?

Are you using the 2.4 beta or the 2.3 version? (testing the tracks in the 2.3 does not show any issues) On which devices & OS have you tested?

20.02.2015, 20:19
Hi Thanks for the reply.
I'm using 2.3 still. Below is my code and here's a link to GPXFiles 2, 3 & 4
I'v tested on iPhone5 & iPadAir2, both on iOS8.1.3. My project is a Swift Project developed in Xcode 6.1

Track2 (https://db.tt/6PRiW7ws)
Track3 (https://db.tt/yvc2mloF)
Track4 (https://db.tt/Bj0k8uuA)

var routeInfo: SKRouteInformation!

func calculateAndDrawTrack() {
var routingSettings: SKRouteSettings = SKRouteSettings()
SKRoutingService.sharedInstance().mapView = self.mapView
SKRoutingService.sharedInstance().routingDelegate = self
routingSettings.shouldBeRendered = true
routingSettings.avoidHighways = false
routingSettings.avoidFerryLines = false
routingSettings.avoidTollRoads = false
routingSettings.routeMode = SKRouteMode.CarShortest
SKRoutingService.sharedInstance().startRouteFromGP XFile(pathToGPXFile)

func routingService(routingService: SKRoutingService!, didFinishRouteCalculationWithInfo routeInformation: SKRouteInformation!) {
routeInfo = routeInformation

func routingServiceDidCalculateAllRoutes(routingService : SKRoutingService!) {

As you can see I'm using routingServiceDidCalculateAllRoutes in combination with didFinishRouteCalculationWithInfo. I had to do this because with these tracks didFinishRouteCalculationWithInfo gets called 2 or 3 times before I see the total track rendered on screen. I'm assuming the track is split up in several parts for calculation purposes?? routingServiceDidCalculateAllRoutes is only called once, at the end of the calculation when I also see the complete track being rendered on screen. Perhaps the combined usage of both these delegate methods is causing this problem?

23.02.2015, 10:53
Hello, thank you for all the details.
We've reported the issue for further investigation to our development team.
We'll get back to you with an update as soon as possible.

23.02.2015, 15:30
After running some tests on the Tracks you provided in the 2.3 demo project (objective-C):

[SKRoutingService sharedInstance].mapView = self.mapView ;
[SKRoutingService sharedInstance].routingDelegate = self;
[SKRoutingService sharedInstance].navigationDelegate = self;
SKRouteSettings *routingSettings = [SKRouteSettings routeSettings];
routingSettings.shouldBeRendered = true;
routingSettings.avoidHighways = false;
routingSettings.avoidFerryLines = false;
routingSettings.avoidTollRoads = false;
routingSettings.routeMode = SKRouteCarShortest;
[[SKRoutingService sharedInstance] calculateRouteWithSettings:routingSettings GPSFileElement:self.gpsElement];

For track 2:
Distance: 241326 m = 241 km
ETA:16599 seconds = 4,6 hours

For track 3:
Distance: 262526 m = 262 km
ETA: 15694 seconds = 4,35 hours

So the results seem to indicate that the ETA is correctly calculated.
We'll verify the results for the upcoming 2.4 release in the Swift build.

As for the second question: why is didFinishRouteCalculationWithInfo called twice - see http://forum.skobbler.com/showthread.php/6696-Route-rendering-problems-in-iOS

23.02.2015, 17:47
Thanks. That did it. I changed

SKRoutingService.sharedInstance().startRouteFromGP XFile(pathToGPXFile)


let GPXRoot = SKGPSFilesService.sharedInstance().loadFileAtPath( pathToTempGPXFile, error: nil)
let datasource: Array = SKGPSFilesService.sharedInstance().childElementsFo rElement(GPXRoot, error: nil) as Array<SKGPSFileElement>
let gpsElement = datasource[0] as SKGPSFileElement
SKRoutingService.sharedInstance().calculateRouteWi thSettings(routingSettings, GPSFileElement: gpsElement)

Apparently the startRouteFromGPXFile method does not use my routingSettings. Which now, looking back, makes some kind of sense as I did not link my routeSettings to the RoutingService in my previous code. Is there any way to do that other then using the calculateRouteWithSettings method?

Anyway...I still get a slight difference though. For track 2 for example I get the exact same distance, but I get an estimatedTime of 16379 seconds as opposed to your 16599 seconds with the exact same routing settings. Close enough for me, although I do wonder why that is. Any idea?

24.02.2015, 12:00
I'm glad it's now working.

I'm not sure why the difference in estimation - could you send me the points that make up the final route? (e.g. use the http://developer.skobbler.com/docs/ios/2.3.0/Classes/SKRoutingService.html#//api/name/routeCoordinatesForRouteWithId: (http://developer.skobbler.com/docs/ios/2.3.0/Classes/SKRoutingService.html#//api/name/routeCoordinatesForRouteWithId:) method)
This way I can check the 2 routes to see if there are actually any differences in the road geometry.

24.02.2015, 16:26
I just switched to 2.4 beta so doesn't make much sense to compare 2.4 beta outcome with 2.3 outcome I guess.