Developer Solutions for Vehicle Routing Problems

NOTE: An updated version of this article can be found in the Microsoft Maps Blog.

Accurate vehicle routing remains one of the most complex challenges for map app developers, whether it’s a single-user Traveling Salesman Problem (TSP), or an intricate multi-user Vehicle Routing Problem (VRP). 

Bing Maps APIs give developers the tools they need to tackle a range of different vehicle routing scenarios. Let’s have a look at a few popular use-cases where a robust mapping API might come in handy.

Truck routing

Between road closures, tight turns, and low bridges, consistently creating efficient routes for commercial vehicles is a time-consuming task–particularly for businesses handling larger fleets. The Truck Routing API helps developers solve these problems with bespoke vehicle routing solutions. 

The Truck Routing API keeps both your vehicle’s attributes and route limitations in consideration when calculating routes. These optimizations can significantly shorten delivery times and reduce costly delays by ensuring that your routes are fit for your vehicle’s height, length, and even turning radius! Additionally, the API also supports location-aware features like predictive traffic, keeping your fleet out of congested roads with clever alternative routes.

We’re always adding exciting new improvements and updates to our APIs to enable them to keep up with complex vehicle routing problems. That’s why it’s easy to use the full extent of the Truck Routing API’s feature set from the get-go. Take a look at the following code for a glimpse of the API in action.



Content-Length: insertLengthOfHTTPBody
Content-Type: application/json


    "waypoints": [{
        "address": string,
        "latitude": number,
         "longitude": number,
        "isViaPoint": bool
    "avoid": string,
    "dateTime": string,
    "distanceBeforeFirstTurn": number,
    "distanceUnit": string,
    "heading": number,
    "optimize": string,
    "routeAttributes": string,
    "tolerances": number[], 
    "vehicleSpec": {
        "dimensionUnit": string,
        "weightUnit": string,
        "vehicleHeight": number,
        "vehicleWidth": number,
        "vehicleLength": number,
        "vehicleWeight": number,
        "vehicleAxles": number,
        "vehicleTrailers": number,
        "vehicleSemi": bool,
        "vehicleMaxGradient": number,
        "vehicleMinTurnRadius": number,
        "vehicleHazardousMaterials": string,
        "vehicleHazardousPermits": string

Calculating an optimized route for your commercial vehicle is as easy as plugging in the attribute values into the given parameters. Businesses working with hazardous materials can also plan ahead since the API will consider road restrictions for flammable and other materials that require permits.

Here’s what our optimized route would look like. The route in red is the path that the truck would have taken were it not carrying flammable materials, while the green route represents an efficient alternative calculated by the API that doesn’t require a permit. Visit the documentation page to learn more about solving vehicle routing problems with code samples

two truck routes, one for hazardous materials on a map

We’ve only used two waypoints in this example, but developers can easily work with more waypoints for vehicle routes that require multiple stops. Check out the datasheet to learn more about the Truck Routing API’s features.

Case Study: Maplytics

The Truck Routing API played a key role in creating Maplytics, a powerful geo-analytical app designed to improve business operations with smoother routing. The team at Inogic powered their app with core API features like customizable vehicle attributes and optimized routing. The app also used isochrones to visualize travel distances for delivery agents.

Using the app, delivery managers can input their vehicle details and even account for special assets such as flammable materials, if necessary, to solve vehicle routing problems with the click of a button.

Calculating travel times and distances

Not all vehicle routing involves trucks, and powerful services like the Distance Matrix API go the extra mile to help you get to your destination–whether that’s on foot, while driving, or on public transit.

The Distance Matrix API is an excellent tool for solving vehicle routing problems that involve calculating distances and travel times for multiple sets of locations. Support for up to 10,000 origin/destination pairs depending on the key type and travel mode as well as an optional histogram makes the API suitable for a range of scalable enterprise applications.

These applications extend beyond simple vehicle routing. Businesses can use the API to analyze locations for potential expansions depending on prospective delivery times to customers, similarly, it can also be used to group locations for real estate and transport planning applications.

a traveling salesman demo with a travel time histogram

Case Study: Commute Analysis

The Microsoft Real Estate and Facilities (RE&F) team used the Distance Matrix API to perform a detailed commute analysis. During this process, they analyzed travel times of commuting employees with the objective of finding the ideal location that would cut down commute times for the staff. Read the full case study to learn more about how the RE&F team solved their vehicle and public transit routing problem with Bing Maps API.

Multi-itinerary optimization

In practice, many businesses looking for a mapping solution are going to be working with a larger fleet of multiple agents, each with a complex itinerary that includes numerous location-pairs. The Multi-Itinerary Optimization (MIO) API has been designed to tackle these scenarios and make fleet management and vehicle routing a breeze, even for fleets with hundreds of agents. 

Automate your itineraries with an intelligent API that solves travel time problems by building short, optimized routes for each vehicle. The MIO API supports up to 200 agents and 2000 waypoints, including customizable parameters such as opening and closing times to help businesses mold their mapping solution to their unique requirements. Account for multiple stops, busy traffic, and improve ROI with a tailored itinerary.

MIO Demo - Try it yourself!

Solve a multi-agent vehicle routing problem with the MIO demo to see it in action, including key features like predictive traffic, dwell times, and price optimizations. Multi-stop route planning has never been easier, and we intend to keep it that way with interactive demos, and constant updates.

High-accuracy vehicle routing

The Snap To Road API complements these mapping solutions by enhancing vehicle routing accuracy using GPS traces and route visualization. GPS points aren’t always accurate to map visuals, creating room for error in crucial asset tracking applications. This API snaps those GPS points to roads, including full road names and even their associated speed limits.

a snap to road route comparison graphic

Use up to 100 GPS points per API call and leverage multiple transport methods to create highly accurate routes for commercial applications. Much like with batch geocoding, this API saves developers the hassle of having to make multiple API calls when entering a long list of GPS points.

Developer-friendly mapping solutions

It doesn’t matter whether you’re a seasoned developer or a beginner looking to solve their first vehicle routing problem. Bing Maps API backs you up with an array of useful developer resources with answers to vehicle routing issues that might crop up during development. Get your burning questions answered and build together in the community forums, or, open up an interactive code sample for guidance. 

The interactive V8 SDK is a great tool for developers to get familiar with everything Bing Maps API has to offer. This fun and immersive introduction to web mapping includes editable code samples for routing applications and developer-friendly features found in Visual Studio, such as intellisense. 

Get a head start on solving vehicle routing problems and build a robust mapping solution with Bing Maps API, create a free key to get started. 

Explore Vehicle Routing APIs

Dive deeper into Bing Maps API’s vehicle routing solutions with these detailed datasheets.