Skip to main content
Skip to main content
Maps

Microsoft Maps Blog

Developer Solutions for Vehicle Routing Problems

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.

HTTP POST REQUEST URL

https://dev.virtualearth.net/REST/v1/Routes/Truck?key={BingMapsKey}

POST HEADER

Content-Length: insertLengthOfHTTPBody
Content-Type: applicationhttps://www.microsoft.com/json

POST BODY

{
    "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 with hazardous cargo

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.

 

 

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.

 

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.

 

 

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.

 

Snap to Road API

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.



Microsoft Maps

Explore everything that the Microsoft Maps Platform has to offer

Back to top