Microsoft Bing Maps – Snap to Road API
Blog|by Jamie Maguire|23 February 2018
Introduction
In this blog post, we look at the Bing Maps Snap to Road API. Sometimes it can be difficult to analyse your fleet’s activities from a data perspective. The Bing Maps Snap to Road API alleviates some of the pain involved when it comes to fleet management and allows you to monitor your assets’ activities to help you better manage resources.
With features such as multiple travel modes, speed limits and route visualisation, the API offers many business opportunities which include, but are not limited to:
- delivery optimisation
- fleet and asset management
- improved safety and operations
The Problem
When using a GPS to navigate or trace specific routes, sometimes the coordinates supplied don’t always match up to the road or path you need to travel.
How the API helps
With the Snap to Road API, you can input GPS points (in the form of latitude and longitude) along a specified route to return a corresponding set of data points that “snap to” to the most likely roads and corresponding road names that the vehicle or asset has travelled along.
These data points also include attributes such as speed limits that can help improve safety, and if required, users can request that data points are interpolated.
For the curious out there, interpolated data points result in a path that smoothly follows the actual geometry of the roads on a map which can further help provide enriched visualisations and analytics
From a fleet and asset management perspective, the API lets you identify if drivers are observing national speed limits, determine if drivers go off route and how much time the assets are spending time in transit and much more!
Analytics and Visualisation
Sometimes, tracking moving assets isn’t entirely accurate, GPS devices can lose their signal or even incorrectly place GPS points off the road. The Snap to Road API allows you to track an assets route by snapping points to the nearest road for display purposes (as well as view the data for each point).
Consuming the API
Like the other Bing Fleet Management APIs, the Snap to Road API is easy to consume. It can be invoked over REST in a language of your choice or you can test it using a product like PostMan.
If we consider the following fictitious journey through Newcastle Upon Tyne to a restaurant in Gosforth – again in Newcastle Upon Tyne with the following latitude and longitude combinations:
Constructing the request
You can take these pairs of latitude and longitudes and construct the following request:
Alternatively, if you prefer you use a PostMan:
Results
When invoked with these parameters, the Snap to Road API returns the following JSON:
The observant among you will have noticed slight discrepancies between the originally supplied collection of latitude and longitudes we supplied and the calculated coordinates returned by the Snap to Grid API for our journey:
This is because whilst we specified Newcastle Upon Tyne as our starting point (54.978252, -1.61778), and whilst this latitude/longitude may be the central location point for the city, if we plot this location on a BING Map you can see it’s in the middle of a hospital! The coordinates returned from the Snap to Grid API however (highlighted by the green circle) are correctly placed on the actual road:
The outcome is the same for the second collection of latitude / longitude pairs which you can see below:
It’s easy to see the benefits that improved accuracy, coupled with enriched analytics can bring.
XML Response
Like the other APIs we’ve discussed in previous blog posts, consuming the Snap to Road API is straight forward which makes it easy for developers to integrate it with your existing product software products and solutions. If you’d prefer to work with XML, the API can return that too:
Summary
In this blog post, we explored some of the benefits the Snap to Road API offers and how easy it can be easily consumed.
You can find out more about the API here. Alternatively, if you’re a developer, you can read more information in terms of consuming the API here.
Are you using any of the Bing Maps APIs in your software solutions? Contact the Grey Matter mapping experts to help you get set up, discuss your use case and licensing requirements: mapping@greymatter.com or call +44 (0)1364 655 133.
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
Acronis Launches Cyber Security Awareness Training
Acronis Cyber Security Awareness Training is the new addition to the Acronis security stack. It’s there to help clients become even more secure by helping individuals learn security best practices to prevent data breaches. Why do businesses need cyber security...
Empower Your Business with Adobe Express: The Ultimate Content Creation Tool
With its powerful features and user-friendly interface, Adobe Express is built to help businesses create and edit standout content with ease.
Overview of Past Cyber Threats and 2025 Cyber Security Trends
Are you aware of the latest cyber security trends? Cyber security is everywhere. You might find it hard to keep up with key cyber threats and trends as you’re too busy or overwhelmed with the sheer amount of information out...
AI Meets Creativity: Exploring Adobe Creative Cloud’s Intelligent Features
Automate repetitive tasks and enhance creativity with Adobe Creative Cloud AI tools. In this blog we explore the AI features and benefits.