PDA

View Full Version : Routes with multiple waypoints. Multiple routes. Map Legend.



jonathanyong81
12.02.2015, 18:47
Can anyone help with these questions please?

Does the Skobbler SDK support routes with waypoints in between the start and end point?
Also does it support drawing multiple routes on the map in different colors? And does it support displaying a Legend / Key to indicate what those colors represent?

Many thanks.

Adela_Silvia
13.02.2015, 12:16
Hello Jonathan,

For adding ViaPoints waypoints which will allow you to create a route with intermediate stops and add/remove waypoints to an already existing route- you have to wait for the next version 2.4 (estimated release time: end of month) or you can test the beta version available via cocoapods: https://github.com/CocoaPods/Specs/blob/master/Specs/ScoutMaps-iOS-SDK/2.4-beta1/ScoutMaps-iOS-SDK.podspec.json

Changing colors for the routes- currently the appearance of routes (the main route and the alternates) can be styled by editing the style JSON files that can be found in the SKMaps.zip archive that stores the resources. In the demo these JSON files are daystyle.json, grayscalestyle.json, nightstyle.json and outdoorstyle.json.
Here you can find a modified daystyle.json file in which the route colors have been changed. Look for comments ("//") in this file to find out which properties were modified in order to change route colors. Similar changes in the other JSON style files should be made in order to modify route colors for the rest of the map styles.

For the moment changing the route color dynamically or styling route segments differently is not currently supported in the SDK.\
And another scenario:
-while you cannot color the route, you can color various road segments along the route provided that you draw them separately. Retrieve the route information by calling routeCoordinatesForRouteWithId
NSArray *locations = [[SKRoutingService sharedInstance] routeCoordinatesForRouteWithId:routeInformation.ro uteID];

Note: make sure you have set requestExtendedRoutePointsInfo to true for SKRouteSetttings before calling calculate route. And then you'll have access to the road segments, which you can draw on the map as colored Polylines.

Adding a map legend: you'll would have to implement this logic yourself, on the client side.

jonathanyong81
13.02.2015, 12:19
Hi,
That's great. Thanks for the information! I think you've answered everything I wanted to know and it has cleared things up for us.

guidove
17.02.2015, 06:08
Hi Adela,

Will there be a limit to the number of via points / intermediate stops that can be added to a route? If yes, what is the maximum number of intermediate stops?

Many Thanks

Adela_Silvia
17.02.2015, 10:40
Hi guidove,

From our tests, we can say that by adding 25 intermediate stops you should not encounter any issues. Let us know if you need any help.

Best regards,
Adela

jonathanyong81
17.02.2015, 11:31
With regards to plotting multiple routes, can the SDK allow us to plot an arbitrary number of completely separate routes? e.g. if I have multiple bus routes, can the SDK do that? Or does it only support plotting one route at a time (plus the alternates). Thanks.

Adela_Silvia
17.02.2015, 11:59
Hi Jonathan,

For your scenario we recommend this approach: to calculate all the routes and then draw polylines on the map based on those routes.
You can get the coordinates for each route with
http://developer.skobbler.it/docs/android/2.3.0/com/skobbler/ngx/routing/SKRouteManager.html#getExtendedRoutePointsForRoute (int) or http://developer.skobbler.it/docs/android/2.3.0/com/skobbler/ngx/routing/SKRouteManager.html#getCoordinatesForRoute(int) and then draw coloured SkPolylines on the map
Check the "GettingStarted" documentation http://developer.skobbler.com/getting-started/android#sec009

The routes can be saved & loaded from the cache (so that you don't spend time on recalculating them) when needed (http://developer.skobbler.com/docs/android/2.3.0/com/skobbler/ngx/routing/SKRouteManager.html#saveRouteToCache(int) and http://developer.skobbler.com/docs/android/2.3.0/com/skobbler/ngx/routing/SKRouteManager.html#loadRouteFromCache(int)).

Please let us know if you manage to solve it this way.

jonathanyong81
17.02.2015, 12:02
Excellent thanks for the advice!