We’re all looking for the most efficient route to get from point A to point B. But what if you add points C, D, E, F, G, and H? Many know this as the “Travelling Salesman Problem” or “TSP”. We’re happy to announce the Mapzen Optimized Route service: powerful enough for businesses and logistics companies yet still accessible to the individual user. Optimized Route is a part of the Mapzen Mobility toolkit, a set of services powered exclusively by open-source software and open data.
Create your own optimized route
Optimized routes have long been a mainstay in the world of logistics and shipping. Businesses need it too: think of pizza delivery, sales people, and real estate agents showing houses. But wouldn’t it be nice if you, the everyday human running errands, had an easy-to-use service that calculates your route based the times and distances to all of the places you need to go every day? With Mapzen Optimized Route, anyone with things to do and a list of locations can take advantage of it.
In San Francisco, there are a lot of burritos. Too often you ask yourself how you might visit all of the best taquerias in the City. How could one possibly plan this journey of burrito enlightenment? Mapzen Optimized Route is here to help! We here in the Burrito Research Division of Mapzen have geocoded some of San Francisco’s top rated burritos according the famed (but sadly retired) Burritoeater.
You may not agree with all of these burrito dispensaries, so drag and drop the emoji across town and watch the route optimize on the fly!
Under the hood - how does it work?
We take your location list and submit it to our cost matrix source-to-target algorithm to calculate the times and distances from each location to every other location. This is the same cost matrix algorithm that we use for our Mapzen Matrix service and has proven to be extremely efficient.
Under the hood, the cost matrix performs a backward search from all target locations and a forward search from all source locations. The connections between the two search spaces are checked during the forward search. (Any locations that are the same get set to a zero
time, distance and are not added to the remaining location set.) We then send the list of times and distances to our optimizer which returns a route response based on the reordered locations.
How do I use this amazing time-saving service?
You can either end your route at the final destination location or you can end your route at the origin where you started. (Please remember that the first and last location will always remain fixed in your route.)
To format an Optimized Route request, we have provided a new action called
optimized_route. Just send a list of lat/lon locations in any order, your costing mode (auto, bicycle or walk), API key, and Mapzen will take care of the rest! (You can either end your route at the final destination location or you can end your route at the origin where you started. And please remember that the first and last location will always remain fixed in your route.) We will reorder your locations in an optimized route response with a route shape, saving you time and money.
A sample Optimized Route request:
A small note on performance and limitations
Performance is fairly similar to our
many_to_many matrix requests. As mentioned above, we are now using a more efficient cost matrix algorithm that has improved performance substantially. We currently have a few location and distance limits in place for this purpose and you can read more about them in the documentation.
Check it out!
Note: This post was updated on May 22, 2017 to reflect new documentation URLs and rate limit information.