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
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:
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.
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:
In this blog post, we explored some of the benefits the Snap to Road API offers and how easy it can be easily consumed.
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: email@example.com or call +44 (0)1364 655 133.