How to match GPS traces to the most probable route
HERE Route Matching API v8 computes the (most probably driven) route through a given GPS trace.
Typical GPS inaccuracies are taken into account, and arbitrary gaps are handled appropriately.
For information on input data, see GPS trace file formats and accuracy requirements.
Often, the map matched trace shall be enriched with HERE map attributes, like speed limits, slope, curvature, motorway / inside city, number of lanes, traffic / weather situation.
These can be directly included in the route match response.
Another use case is learning the driver's daily commute paths by HERE Route Matching API v8, storing the cornerstones of these routes, and then every day sending this route path to HERE Routing API v8 to obtain the driving time under current traffic situation as well as incidents along this route.
So drivers get alerted when they should depart earlier than usual, or that everything is as usual.
Code
This is a sample request. To run it, you must supply the API key and replace the @PATH_TO_GPS_TRACE_FILE placeholder with a path to a valid GPS trace file in the GPX format.
curl -X POST -H "Content-Type: application/json" --data-binary @PATH_TO_GPS_TRACE_FILE "https://routematching.hereapi.com/v8/match/routelinks?routeMatch=1&mode=fastest;car;traffic:disabled&legal=access,oneway,thrutraf,turn&attributes=LINK_FCn(REF_NODE_NEIGHBOR_LINKS,NONREF_NODE_NEIGHBOR_LINKS)apiKey=API_KEY"As a response, the route calculated by the Route Matching API from the trace is displayed in green.
The route calculated by the Routing API is displayed underneath it in red together with live traffic or guidance information.
The response includes a list of specific warnings at route links.
A sample response might be "Gate traversal onto link 786918237".
Note
There is no strict limitation on the number of waypoints per request. The computational effort depends on the number of kilometers that the GPS trace traverses. If the computation time for a waypoint request exceeds ~ 50 sec, the request is cancelled.
Procedure
You can provide the input data using the sample request from the preceding section.
Alternatively, you can provide a trace file directly to the interface.
Open the example https://demo.support.here.com/examples/v3/rme_daily_commute.
A list of points and speed limits at those points can be provided and the Route Matching API will calculate a route through them.
The trace data is inserted using a trace file in the formats CSV, GPX or NMEA.
The trace file contains data such as coordinates, elevation, or speed.
For more information on input formats, see GPS trace file formats and accuracy requirements.
You can also insert trace data by directly clicking onto points in the map.
Result
As a response, the route calculated by HERE Route Matching API v8 from the trace is displayed in green.
The route calculated by the Routing API is displayed underneath it in red together, potentially then showing live traffic impact information (not displayed in this example).
The POST request returns a list of warnings at specific route links.
For more information on output formats, see GPS trace file formats and accuracy requirements.
Updated 7 days ago