The Matrix – Mapzen's Time-Distance Service is Here!

Mapzen is pleased to announce the new Time-Distance Matrix service! Rather than issue a large number of individual routing requests, times and distances can now be efficiently computed to, from, and amongst points, for any costing method or travel mode available in Mapzen Turn-by-Turn (auto, bicycle, or pedestrian).

While a Time-Distance Matrix is usually thought of in terms of delivery and logistics, you may not realize just how useful it can be:

  • Hungry for lunch? The Matrix can help you decide which pizza place is closest.
  • Going house hunting? The Matrix can compute commute distances and times from potential houses to your office.
  • Getting married or having a big party? The Matrix can provide times and distances to guests coming in from different airports.
  • Running a bunch of errands around town? The Matrix can give you an idea of time between all your stops.

Wouldn’t it be nice to quickly and easily calculate time and distance, all in one API call? Mapzen’s Time-Distance Matrix service is here and will make your planning needs easier.

How does it work?

We provide three different Time-Distance Matrix request options. one_to_many is the first, and likely to be the most commonly used. one_to_many will return a row vector of the computed time and distance from the first (origin) location to each additional location provided. This could be useful for finding a place to eat lunch with your co-workers, knowing that you have to be back for that 1 o'clock meeting.

The second matrix type that we provide is the many_to_one. This request will return a column vector of the computed time and distance from each location to the last (destination) location provided. Someone planning their wedding or party can provide their guests the time and distance from nearby airports they could fly into and hotels where they could stay. Your wedding guests will definitely appreciate many_to_one!

Finally, we provide a matrix type of many_to_many. The most computationally intensive, many_to_many will return a square matrix of computed time and distance from each location to every other location. This could be useful for a delivery worker or traveling salesman planning their route.

The service will return your response for distance in either kilometers or miles, whichever units you request.

You can read the Time-Distance Matrix documentation for more information about the options and sign up for an API key.

A small note on performance and limitations

Performance is fairly similar for one_to_many and many_to_one matrix requests. Technically, many_to_one expands from the destination along reverse paths until it reaches each origin. Therefore, it is slightly more expensive to do reverse paths than forward paths, but not noticeable. many_to_many does slow down performance, as it needs to compute every variation of time and distance from each location to every other location. We currently have a few location and distance limits in place for this purpose and you can read more about them in the documentation. To keep the service available to everyone, API requests are rate limited to 2 queries per second and 5000 queries per day.


The following cases illustrate a few use cases of the Time-Distance Matrix service.


Maybe you want to check out a local pizza joint that is near your office for lunch. Do I have time to go from my office (location 0) and Rocco’s Pizza (location 5) that everyone’s talking about?



You’re getting your wedding invitations ready to go out to your guests and you want to give them an idea of the times and distances that they will have to travel to the event (location 4) from their various city locations.



A driver in San Francisco has a list of deliveries to complete Monday morning. The warehouse is at location 0 and the driver wants to get list of times and distances from each location to every other location. This information can help the driver decide on the most optimized path as well as estimate overall travel time.


The sample images here were created using our Test Utility, which uses the Time-Distance Matrix service. Try it with your own examples!

Check it out!

Reach out if you have questions or suggestions! Also, look for optimized routing (including the classic “traveling salesman” problem) coming soon. Sign up for an API key on the Mapzen Developers page and take a look at the documentation. You can also try out our open-source routing with Mapzen Turn-by-Turn.