Routing and Navigation with Mapzen Turn-by-Turn

One of the four pillars of the Mapzen Android SDK is Mapzen Turn-by-Turn, our hosted routing service. Mapzen Turn-by-Turn is powered by Valhalla, our routing engine which is built on open data from OpenStreetMap and Transitland. Mapzen Turn-by-Turn is incredibly flexible and allows for on-the-fly customization of costing models and options.

image via ScotEaster2013_188, CC BY-SA 2.0

image via ScotEaster2013_188, CC BY-SA 2.0

In the Mapzen Android SDK, the interface to Mapzen Turn-by-Turn is On-The-Road, our Valhalla wrapper. On-The-Road handles client-side challenges of routing such as snapping the device location to the closest nearby road, distance calculations, and turn prompting. With On-The-Road, developers can request a route for a set of locations. This object provides information about the user’s progress such as when the user starts moving along the route. It also is aware of when the user is lost and the route needs to be recalculated. In addition, the route knows when instructions are approached and should be called out to the developer or when the user has navigated to the final location.

On-The-Road depends on a small set of external dependencies (Kotlin, OkHttp, Retrofit) and can be used with other tools in the Mapzen suite or as an independent library. In EraserMap, our open source, privacy focused navigation application, we use On-The-Road along side of Tangram, Pelias and Speakerbox. We’ve heard about Tangram and Pelias earlier this week, but what is Speakerbox? Speakerbox is our wrapper around Android’s TextToSpeech class. It provides a simple interface for playing and remixing text and depends only on the Android support library.

Recently, we’ve made some exciting improvements to both On-The-Road and Speakerbox. We migrated On-The-Road away from The Open Source Routing Machine to Mapzen Turn-by-Turn, added more information around instructions and routing events, and added support for a new costing model. In Speakerbox, we added support for audio ducking and the ability to execute code when Speakerbox begins playing text, finishes playing it, and when an error, such as the voice data hasn’t finished downloading, occurs while trying to play it.

We are excited about the improvements to these two libraries and hope that they make developing routing applications easier and more intuitive. Head over to the Mapzen Android SDK to start using them today. As always, if you have suggestions on how to further improve these libraries we would love to hear from you.