We’re back, with our fifth mobile series post, and today we’ll be explaining offline routing for our Maps SDK.
The Maps SDK by CartoDB includes a routing API that enables users to find the fastest path between any number of points, and get route and turn instructions. The routing API works on and offline with the same API for all platforms: iOS, Android, and Xamarin.
Online routing is fairly simple from a developer point of view—the app identifies a number of location coordinates, defines ‘Online routing’ as routing method, selects routing profile and after some milliseconds and one request to our server, you get the route path and instructions. Note: we only support one profile right now: ‘nutiteq.osm.car’ - the fastest route by car using OpenStreetMap data. You can show the route as a line on the map, and instructions as a list, or as popups on the map.
Offline routing is a bit more complex since the app needs to pre-download the map package. Our offline routing data packages are prepared by country, and the code to download them is quite similar to our map packages. Simply select routing:nutiteq.osm.car as data source and the package ID-s have “-routing” as the suffix. For example, for New York, you have to download the “US-NY-routing” data package, which is a 117MB download. For comparison, the map package is 195 MB when downloaded.
For code samples see OfflineRoutingController.mm for our iOS samples, OfflineRoutingActivity.java for Android samples and OfflineRouting.cs for Xamarin/Android samples. The developer guide is also available at https://developer.nutiteq.com/guides/routing. Just make sure you use the latest SDK 3.3.0 snapshot version (as included in sample projects).
Happy mobile mapping and routing!
Please fill out the below form and we'll be in touch real soon.