Announcing Snap to Roads API in Public Preview
We’re excited to announce that our Snap to Roads API has recently entered public preview, which means you can now try out new functionality for reconstructing routes from trace points. Learn how to analyze trip behavior for track and trace, on-demand, and more!
We’re excited to announce that our Snap to Roads API has recently entered public preview, which means you can now try out new functionality for reconstructing routes from trace points. This new API can support a variety of use cases which analyze past routes and movements, both in the track and trace domain, but in on-demand route optimization as well. Read on for more technical details on how to use the Snap to Roads API, and check out the documentation for more details.
Additionally, this public preview opportunity allows for developers to contribute to future versions of Snap to Roads if they wish to share feedback on how this new API can be best optimized to suit various use case needs.
Now, more about Snap to Roads API!
What is the Snap to Roads API?
Snapping GPS-logged points to a road is part of a broader topic called Route Reconstruction (more on that later in this piece!). Essentially, Snap to Roads allows a user to pass in an ordered set of coordinates, which will be compared to known road segments which these coordinates are proximal to. This process is called map-matching. Those matched points create the basis for visualizing a complete, driven route, and providing data for post-delivery/post-ride analysis.
What information does the API return?
After passing in a set of coordinates, and after that set has been matched to a segment or multiple segments, the API can return information about the road segment(s) itself. This includes the number of lanes, speed restrictions on that stretch of road, who owns the road, address data present, and the class of road (FRC). More road attributes are expected to be part of our General Availability release in 2022.
How does it work? (Most importantly, does it snap?)
When you provide coordinates to the API, the snapping algorithm compares the points to known road segments, which are geometrically represented by a line string. Road networks are made up of these lines, which are split into smaller lines to record specific attribution changes, such as a change in speed limit. These smaller lines are referred to as segments.
As an example, if a vehicle’s location trace is recorded once each second, multiple points might be projected onto one segment. The API will recognize this duplicate matching of segment and repeat matching points from the input until a new segment is found, return that segment, and continue this process until all points are accounted for – meaning that all matching segments are returned, and a route is then created from the adjoining segments.
What are some tips for using Snap to Roads API?
In addition to passing points, you can pass a list of headings (compass directions, in degrees), which can act as a guide from the first point to the next, and so on for each subsequent coordinate. Sometimes, subsequent points might be projected onto the wrong road, which can happen due to GPS probe errors. For example, this might happen when the GPS probe (i.e., the device is logging locations) registers a new point as a car passes by an intersecting road, or a neighboring road running parallel to the current one, and the device’s location registers its position inaccurately. That’s where headings can help orient the intended direction of travel between points and mitigate those errors.
Additionally, Snap to Roads API supports GraphQL, which can help you query and receive customized responses based on the technical needs for your project.
What are the uses for this new API?
Tracking use cases align well with Snap to Roads API. If a construction vehicle is outfitted with a tracking device which logs location say, every 30 seconds, a fleet manager could put that data to use in order to reconstruct where that vehicle has traveled over a desired period of time.
More interestingly, because road segments’ speed limits are available through use of the API, it can be used to detect driving violations and log habits of dangerous driving over longer spans of time and stretches of highway. This can be useful to managers of fleets, but also to insurance companies, who can turn the situation into a benefit for drivers.
By visualizing and analyzing driven routes, one can get a sense for average driving speed, areas traveled to and from, and how often, creating a bigger picture of someone’s driving style and mileage needs over time. This can be utilized not only for rewards purposes, but potentially risk management and proper outfitting of the right kinds of coverage; a car driven mostly on the weekends on low-usage roads might have different needs than a commuter car driven on busy freeways, or at high speeds.
More questions?
For more resources on using Snap to Roads, or questions as you build with our new API, reach out to us on our Dev Forum, or ping us on Twitter.
Happy Mapping!