Bing Maps Routing API knows the shortest route that visits all waypoints!

Often referred to as ‘the traveling salesman problem’, planning how to most efficiently travel to a number of stops is an age-old problem. It’s difficult enough to optimize the stops for a single driver or delivery person’s day, and the challenge compounds quickly when trying to optimize map routes for a fleet of drivers, your mobile salesforce, or a large team of repair personnel in the field traversing large distances.

A powerful addition to the Bing Maps routing API is now available to help! With waypoint optimization you can pass in up to 25 waypoints (stops) and they will be re-ordered and optimized to minimize travel time or distance. Microsoft.com Maps developers can completely streamline business operations with the ability to create optimized routes for multiple addresses.

How it works

Let’s look at a real-world use case to better understand the benefits of multiple address routing optimization. Let’s say you run a delivery business in Kansas City. Your day begins downtown and ends in North Kansas City. Along the way you have 6 stops to make. The Route shown here in the first map was calculated based on the order the stops were passed in. That’s 131 miles and 2 hours 54 minutes of driving. In the second map, we see the result of specifying the ‘optimizeWaypoints=true' flag on the API call. Much better! We just saved 27 miles and 30 minutes of driving.

 

Before optimization

route for multiple addresses in Bing Maps

After optimization

Bing Maps Multiple Address Route Optimization

A successful example of Bing Maps API’s multiple address routing capabilities being put to use is Maplytics. The Maplytics developers created an app that used Microsoft.com Maps’ geographical insights and SDKs to make truck routing easy for businesses. Using the app, businesses can input multiple delivery destinations and receive optimized routes that save both time and money. These routes were further optimized due to the Truck Routing API’s support for custom vehicle parameters, allowing the app to create ideal routes that would take the truck’s dimensions into account.

The route optimization performed is based on actual road-distance, which will yield much more accurate results, even for multiple addresses, compared to mapping algorithms that cut corners and use simple straight-line ‘crow flies’ distance between stops.

Geographic constraints like rivers, lakes and divided highways can really throw these calculations off. Consider the simple route below. The straight-line distance from A to B is less than half a mile. But that body of water sitting between them makes the actual driving distance 2 miles. For enterprise-grade results, you definitely want to avoid any route optimization that use straight-line distance calculations behind the scenes!

Bing Maps Single Route Optimization

Another clever in-house solution to this problem is the Snap To Road API. When plotting routes that involve multiple address points, it’s entirely possible for older software to map direct routes using older algorithms that use straight-line distance calculations. Snap To Road API addresses this problem by snapping a given set of GPS points to the closest road coordinates. This is invaluable for travelers and businesses that tend to operate in areas where the connection might be unstable, leading to incomplete data. 

Competitive pricing

Now you’re probably thinking, this is great, but how much is this added functionality going to cost me? Here’s the best news – there is no additional charge for an optimized route! Each API call to the routing service is 1 billable transaction, whether the optimize flag is specified or not. And that includes passing in up to 25 waypoints for optimization. For requirements of more than 25 waypoints, please contact Bing Maps team at maplic@microsoft.com.

If you already know which stops a given driver in your fleet is going to make, this new optimization capability can bring big cost and time savings to your organization. These savings are further compounded by the efficient integration of Bing Maps API with other Microsoft.com apps, saving developers the hassle of having to port code to new platforms.  

Optimize routes for multiple addresses and drivers

What if you have dozens of drivers needing to make 100 stops? Which stops should be assigned to which drivers to provide each driver with the most efficient itinerary?

The Bing Maps Distance Matrix API is ideal for solving this complex logistics map routing problem. You can use it to compute optimal travel time and distances from all origins to destinations at scale, and then combing with optimization algorithms find the best stops for each driver to make. You can then use the waypoint optimization function to find the best driving directions with turn by turn instructions for each driver’s itinerary.

Here’s a simple preview of how this works in practice with HTTP Post.

{
    "origins": [{
        "latitude": 47.6044,
        "longitude": -122.3345
    },
    {
        "latitude": 47.6731,
        "longitude": -122.1185
    },
    {
        "latitude": 47.6149,
        "longitude": -122.1936
    }],
    "destinations": [{
        "latitude": 45.5347,
        "longitude": -122.6231
    }, 
    {
        "latitude": 47.4747,
        "longitude": -122.2057
    }],
    "travelMode": "driving",
    "startTime": "2017-06-15T13:00:00-07:00"
}

In the example above, we can see how simple it is to input multiple origin and destination addresses when optimizing routes with a distance matrix. In this case, we’re using three coordinates as origins and two as destinations. The “travelMode” parameter specifies how your agents will be traveling. In this case, we’re using the “driving” value, but the Distance Matrix API supports multiple travel modes, including “walking” and “transit”. 

Additionally, this request also automatically includes predictive traffic data when coming up with an estimate. A relatively short distance and straightforward map route from point A to B might look like the best option at first glance, but this can rapidly change when traffic conditions are factored in. As a result of this feature, businesses can enjoy estimates that are not just accurate, but also contextually relevant.

Customer story: LinkedIn

A unique strength of Bing Maps APIs is interoperability. The Distance Matrix API can be complemented with the use of other innovative interfaces such as the Isochrone API. This is useful for calculating the distance that can be covered in a given amount of time, or vice versa. Check out our customer story to find out about how the LinkedIn team used the Isochrone API to streamline job hunting by taking into account commute routes for multiple business addresses.

Create a key for free and optimize routes for multiple agents in minutes using our developer-friendly API.

Learn more about the Distance Matrix API on our website and check out the developer docs. Also, for code samples, go to GitHub.

- Bing Maps Team

Share on twitter Share on facebook Share on linkedin Share on linkedin