Microsoft Bing Maps Truck Routing API
Blog|by Jamie Maguire|19 December 2017
Introduction
If you follow developments in the Microsoft Bing Maps space, you’ll no doubt be aware of the existing routing services that are on offer by the technology.
Whilst existing routing services take standard vehicles, public transport and pedestrians into account, they often don’t consider larger vehicles such as HGV’s, lorries or trucks that can be used in the logistics sector.
These types of vehicle can have speed restrictions, aren’t allowed on specific roads and drivers need to consider the characteristics of the road during each part of the journey, not to mention the specific attributes of their vehicle.
Journeys like this require an extra layer of route planning. It’s with these challenges in mind, that Microsoft have implemented a solution that takes into consideration all possible data attributes and road characteristics.
The solution is provided by the new Truck Routing API which allows transportation professionals to plan the safest and most optimal route for their freight.
Truck Routing API
The Truck Routing API allows you to implement solutions that can generate logistics routes using a series of waypoints and attributes.
Waypoints are supplied in the form of coordinate pairs along with the road and truck characteristics that are relevant to your journey and transportation vehicle.
Some of the attributes that Project Johannesburg will take into consideration include, but are not limited to are:
- road types to minimize or avoid
- vehicle height
- vehicle width
- vehicle length
- vehicle weight
- the type of hazardous materials onboard the vehicle (explosive, gas, poison, radioactive etc.)
- distance – generate routes with the shortest distance
- time – generate routes that take the shortest time
- time with traffic – generate routes with the quickest time using current traffic data
- time avoiding road closures – generate routes that avoid road closures
- flag to indicate if the vehicle should avoid crosswinds
Using these attributes, coupled with collections of waypoints, you can construct requests and submit them to the Truck Routing endpoint which will then calculate and return valid truck routes.
Calculating a Truck Route
From a developer’s perspective, routes can be generated by issuing HTTP or HTTPS requests. These are then submitted to the Truck Routing endpoint by providing your subscription key and by setting any waypoints / attributes that are relevant to your truck and route.
You can obtain a subscription key here if you don’t already have one.
For example, you can calculate a route with the following waypoints and truck attributes:
- Waypoint 1: 2600-2622 E Galer St, Seattle, WA 98112, USA
- Waypoint 2: 1730 Boyer Ave E, Seattle, WA 98112, USA
- Vehicle Height: 5 metres
- Vehicle Length: 10 metres
These are then added to the following endpoint: https://cognitivegarage.azure-api.net/Routes/Truck. In the screenshot below, you can see a simple request being constructed in Postman with the waypoints and attributes we mentioned earlier:
When invoked, the endpoint will return routing data that supports vehicles that are 5 metres in height and 10 metres in length which you can see here:
Routing data for a simplistic journey like this contains over 500 lines of rich metadata which can be parsed and imported into your fleet management application.
The data can also be used to generate a Bing Map with waypoints that have been identified as being suitable for your journey and vehicle. In the image below, you can see that whilst two routes are available, only one is safe given the characteristics of the truck (height of 5 metres and length of 10)
Drilling down into the Bing Map Street View of the route in red, you can see there is indeed a low bridge that a truck with the characteristics we’ve supplied clearly couldn’t drive through:
Some other use cases where this technology can help include, but are not limited to:
- identifying and avoiding sharp turns
- identifying and avoiding steep gradients
- identifying routes where transporting of dangerous freight is forbidden
Naturally this endpoint doesn’t have to be consumed using Postman and can be invoked in a language of your choice, C#, JavaScript and so on. With an incredible low barrier to entry, developers can build mapping solutions quickly.
Resources and Demos
If you aren’t ready to build solutions quite yet, and want to see the Truck Routing API in action, you can explore some of the demos and API endpoints online.
Truck Routing Demo
The Truck Routing demo site allows you to supply a latitude and longitude, as well as some vehicle attributes and invoke the Truck Routing API directly. It will then plot a valid route based on the parameters you’ve supplied.
If you don’t want to supply your own parameters, you can select from four pre-determined “scenarios” which will autofill the required fields for you.
You can find out more about the Truck Routing Demo site here.
Test Console
Alternatively, if you’re more technical and want to explore the API endpoints and try out the various available parameters, you can try out the Test Console. The Test Console, which is part of the Cognitive Services Lab, gives you early access to emerging and experimental technologies.
The Truck Routing service within the Test Console allows you to add or remove parameters and construct HTTP requests using an intuitive webpage.
You simply supply the parameters you’re interested in and click Send. The Truck Routing API will then return a response that contains all relevant truck routing data.
Summary
From a developer’s perspective, these APIs and services have been packaged up into easy to use APIs that can integrate seamlessly with your existing business solutions.
Want to learn more about the Truck Routing API? Please call the Grey Matter mapping specialists:
+44 (0)1364 655 133 or email: mapping@greymatter.com
Contact Grey Matter
If you have any questions or want some extra information, complete the form below and one of the team will be in touch ASAP. If you have a specific use case, please let us know and we'll help you find the right solution faster.
By submitting this form you are agreeing to our Privacy Policy and Website Terms of Use.
Jamie Maguire
http://www.jamiemaguire.netSoftware Architect, Consultant, Developer, and Microsoft AI MVP. 15+ years’ experience architecting and building solutions using the .NET stack. Into tech, web, code, AI, machine learning, business and start-ups.
Related News
Understanding DMARC: A Guide for Organisations
In today’s digital age, email remains a critical communication tool for businesses. However, it is also a prime target for cyberattacks such as phishing and email spoofing. To combat these threats, organisations can implement DMARC (Domain-based Message Authentication, Reporting, and...
Acronis Offers Native Support for Amazon S3 and Wasabi
Acronis can now offer direct support for Amazon S3 and Wasabi cloud storage. This update elevates the data protection capabilities, ensuring you can rely on the most reliable and efficient backup solutions. This is great news if you are looking...
Essential Security Tests for your Business
You may have implemented several cyber security solutions to protect your business or done your best to ensure your app is secure. But how can you be sure there aren’t any security gaps that could lead to a potential breach?...
Why businesses are turning to Managed Detection and Response Services
Cyber security is a top priority (or at least should be) for all businesses. From various breaches to more regulations being created. But for some, it can be hard to manage effectively. This is why Managed Detection and Response (MDR)...