The open-source ecosystem powering Coord’s router

Jacob Baskin
Coord
Published in
4 min readJun 4, 2018

How we used OpenTripPlanner to build a real-time, mixed-mode Routing API

This week, we released a mixed-mode router that lets you plan trips with both transit and shared bikes. We’re very excited about the release, and we wanted to talk a little more about the technology we used to build our Routing API.

We’re living in a golden age of open mobility technology. From geospatial tools like PostGIS to data like OpenStreetMap to standards like GTFS, there’s a wealth of resources that enrich the mobility ecosystem. Companies, cities, and enthusiasts collaborate to make amazing new applications and extend existing software.

At Coord, we’re excited to be part of this: not only does open source software make it much easier for us to share our APIs with projects and developers who might benefit from them, we use lots of open source software to build the APIs in the first place. For our router in particular, rather than building a new engine, we decided to use an existing, open-source project called OpenTripPlanner to back our Routing API.

Why OpenTripPlanner?

OpenTripPlanner (OTP for short) was initially developed in 2009 for TriMet, the regional transportation agency for the Portland, Oregon metropolitan area. Since then, it’s been expanded into a comprehensive and easy-to-use trip planning tool for cities around the world.

OTP was the obvious choice for us to use for a few reasons. First of all, it’s open source. Not only does this mean we benefit from the efforts of all the other developers who have worked on it, open source also means that we can introduce our own changes into OTP as needed. We’ll talk a bit more about the changes we’ve made to OTP below. Not only that, OTP also supports bike-share routing out of the box, and even combined bike-share and transit trips! To our knowledge, it’s the only open source routing engine that does so. OTP is also very configurable: you can easily change dozens of routing parameters, which lets us make sure that our routing experience works well for our use cases.

OTP has some disadvantages, too. Its configurability can be one of them: getting good results from OTP really depend on setting its parameters appropriately. Also, OTP loads its entire routing graph into memory, meaning that OTP works well for individual cities or regions but not for the entire world or for a large country. Additionally, each OTP instance supports only one time zone at once. This means that we will have to run multiple OTP instances for different regions as our coverage increases. But we’ve been very happy using it so far.

Coord + OTP = Good Routing Made Simple

You might ask, if we’re just using OTP, why do you need Coord? Can’t you just run your own OTP instance? You’re welcome to do that, but we think there are big advantages to using a hosted routing service like ours.

First of all, we did substantial work to extend the capabilities of OTP itself. This includes adding support for dockless bike share, and also integrating Coord’s Bike-Share API as an OTP data source. Our latest and greatest version of OTP is always accessible through our Routing API.

In addition to our work on OTP itself, we invested heavily in fresh, high-quality data. Coord’s Routing API builds on our Bike-Share API, meaning we always have live availability information for bike share systems. We also make sure to keep transit schedules and our base map up to date. When you call Coord’s Routing API, you don’t have to worry about ingesting and processing this information on a regular basis: we take care of it for you.

Also, server administration can be hard work! When you use Coord’s API, we handle keeping the router service up and running so that you just have to call it whenever you want. If you want, you can even call it directly from your website our mobile app without running a backend service at all.

Finally, by providing an easier-to-use API, we do the hard work of tuning and configuring OTP so it works well for a trip planning use case. We’ve spent lots of time making sure that OTP returns useful, real-world mixed-mode trips. By using Coord’s APIs, you can take advantage of this work for yourself.

What’s Next?

Now that we’ve launched our Routing API and demo app, we’re focusing on expanding our API’s capabilities and adding more cities. We’d love to hear from you at partners@coord.co if you have any particular city or feature suggestions for us!

We’re also working on getting the improvements we’ve already made to OTP back to the main GitHub repository. If you already run or want to run an OTP instance of your own and are interested in getting early access to these changes, check our our public repository containing all of our changes to core OTP, including support for Coord’s Bike-Share API and dockless bike share routing.

There’s no way we could have built the Coord platform without the work of the countless companies, cities, and individuals who contributed to all of the open tools, data, and standards we use every day. We hope that we can continue to both benefit from and contribute to the fantastic open-source mobility ecosystem as we grow.

--

--

Jacob Baskin
Coord
Editor for

CTO at Coord, bringing mobility online and connecting software to the physical world.