Results 1 to 8 of 8

Thread: estimatedTime incorrect for route calculated with startRouteFromGPXFile

  1. #1
    Erfahrener skobbler
    Join Date
    11.02.2015
    Posts
    123

    estimatedTime incorrect for route calculated with startRouteFromGPXFile

    Hi,

    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?
    Last edited by guidove; 19.02.2015 at 20:25.

  2. #2
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    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?
    Last edited by Adela_Silvia; 20.02.2015 at 14:07.

  3. #3
    Erfahrener skobbler
    Join Date
    11.02.2015
    Posts
    123
    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
    Track3
    Track4

    Code:
    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().startRouteFromGPXFile(pathToGPXFile)
    }
        
    func routingService(routingService: SKRoutingService!, didFinishRouteCalculationWithInfo routeInformation: SKRouteInformation!) {
            println("didFinishRouteCalculation")
            routeInfo = routeInformation
    }
    
    func routingServiceDidCalculateAllRoutes(routingService: SKRoutingService!) {
            println(routeInfo.estimatedTime)
    }

    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?

  4. #4
    Oberskobbler
    Join Date
    22.07.2014
    Posts
    399
    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.

  5. #5
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    After running some tests on the Tracks you provided in the 2.3 demo project (objective-C):
    Code:
        [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...roblems-in-iOS

  6. #6
    Erfahrener skobbler
    Join Date
    11.02.2015
    Posts
    123
    Thanks. That did it. I changed

    Code:
    SKRoutingService.sharedInstance().startRouteFromGPXFile(pathToGPXFile)
    to

    Code:
    let GPXRoot = SKGPSFilesService.sharedInstance().loadFileAtPath(pathToTempGPXFile, error: nil)
    let datasource: Array = SKGPSFilesService.sharedInstance().childElementsForElement(GPXRoot, error: nil) as Array
    let gpsElement = datasource[0] as SKGPSFileElement
    SKRoutingService.sharedInstance().calculateRouteWithSettings(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?

  7. #7
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    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: method)
    This way I can check the 2 routes to see if there are actually any differences in the road geometry.

  8. #8
    Erfahrener skobbler
    Join Date
    11.02.2015
    Posts
    123
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •