PDA

View Full Version : Relation between routeConnectionMode and connectivityMode?



guidove
31.05.2016, 19:18
Hi,

My app is in beta test now and I'm getting a lot of feedback that sometimes route calculations takes a long time (up to 30 seconds). Sometimes when calculating an initial route, and also sometimes when a recalculation is triggered because the user deviates from the route while navigating. I can't be sure but I'm assuming it's related to the quality of the internet connection a user has. (Or is there another reason why calculation might be slow? Such as one of the via points not being exactly on a road?) So I was playing around with the SKRoutingSettings routeConnectionMode property.

It seems setting routeConnectionMode to Offline in stead of the default 'Hybrid' does not make a lot of difference. The network activity indicator still starts spinning ( I image this is because it's downloading Map Data for the area?) and calculation seems to last more or less the same amount of time.

So, my questions are:
1. What's the result of setting the routeConnectionMode to Offline?
2. Are there any disadvantages to setting routeConnectionMode to Offline? (for example could this result in an error or failure of a route calculation or recalculation? If yes in what circumstances?)
And... what's the relation between SKRoutingSettings.routeConnectionMode and SKMapsInitSettings.connectivityMode?

Thanks for your response and best regards,
Guido
P.S. I'm using the latests 2.5.1 hot fix for iOS.

dandronic
01.06.2016, 09:13
SKMapsInitSettings.connectivityMode - will configure the connectivity mode at the SDK level - this setting will influence all services: vector tile download, routing services, search services, RealReach services

SKRoutingSettings.routeConnectionMode - is an individual setting for the current route calculation. If you use the Offline setting, the SDK will calculate the route using only local data (cache & on-board maps). Setting it to Online will cause the SDK to rely exclusively on the Routing server. The Hybrid option (the default setting) will use both the on-board data and online data, with priority being given to the on-board data.

One way of greatly improving the routing time would be to make sure that the map data is available on-board - i.e. if I'm going to travel to California or Bavaria and I'm going to be in the mountains (poor internet connection) then making sure that the California/Bavaria map is downloaded locally in advance will ensure fast routing/rerouting times. In this scenario the SKMapsInitSettings.connectivityMode should be online and SKRoutingSettings.routeConnectionMode should be Hybrid

If you always set routeConnectionMode to offline you will limit the SDK to using only local data - if that data is not available locally you will either get a less optimal route or no route - i.e. if you only have the California map, then when trying to create a route to Nevada you either won't receive a route or receive a route that only knows the major highways.

guidove
01.06.2016, 21:27
Hi Dandronic,

Thanks a lot. This is exactly the info I was looking for!

A few follow up questions.
What exactly do you mean with Hybrid option giving priority to on-board data. Does this mean it will not make a connection at all if all required vector tiles are on board or in cache? (if yes, how does it know all vector tiles are on the device?)

Another follow up question considering following scenario:
- SKMapsInitSettings.connectivityMode set to Online
- SKRoutingSettings.routeConnectionMode set to Offline
- No on board maps
- User is in Navigation Mode with map on screen and then deviates from his/her route (i.e. triggers recalculation).
- The recalculated route stays within the downloaded corridor (big assumption I know)
In this scenario is it safe to assume that the recalculated route will be correct? I.e. is it safe to assume that required vector tiles (including the smaller roads) for the recalculation have been cached? I would think yes as the corridor for the route has been cached, right? But then again cache can also be cleared by low memory warning.

And then, finally, suppose there are no on board maps and internet connection is bad (i.e. recalculation would take a long time) Is it possible to prevent or interrupt route recalculation? I've looked through the SDK, but couldn't find a property for that.

Thanks again in advance for your answers.

Adela_Silvia
12.08.2016, 12:45
Hi guidove,

For the first two questions we'll need to ask our developers
For the last question: "Is it possible to prevent or interrupt route recalculation?"
Use routingServiceShouldRetryCalculatingRoute:withRout eHangingTime: http://developer.skobbler.com/docs/ios/3.0.0/Protocols/SKRoutingDelegate.html