How to detect traffic violations in GPS traces
HERE Route Matching API v8 detects traffic violations, such as illegal maneuvers or restricted-zone entries, along a driven GPS trace. The API matches your trace to the road network and reports warnings for any links where the driver deviated from legal routing rules.
For information about supported trace formats, see GPS trace file formats and accuracy requirements.
Send the request
Submit your GPS trace file as the request body of a POST request. Replace PATH_TO_GPS_TRACE_FILE with the path to your file and API_KEY with your HERE API key.
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&'\
'apiKey=API_KEY'The request uses the following key parameters:
routeMatch=1: Enables route matching mode. The API treats the request body as a GPS trace and computes the most probable driven path. By default, the API avoids illegal maneuvers, but uses them if the trace clearly contains them, and reports any such maneuvers as warnings.mode=fastest;car;traffic:disabled: Sets the vehicle type to car and disables real-time traffic.
Read the response
For each matched road link, the API returns any applicable warnings. Warnings identify violations such as driving through a restricted zone or traveling in a prohibited direction.
An example warning message:
Illegally leaving no through traffic zone on link 547294789
Try it
Explore this use case without writing code. See the interactive demo at https://demo.support.here.com/examples/v3/rme_trip_anomalies_detection.
Note
The Show street level areas button in the upper-right corner of the map doesn't currently work. It displays the map as a solid green surface.
- Open the demo link.
- Upload a trace file in CSV, GPX, or NMEA format, or click directly on the map to add GPS points manually.
- The API matches your trace to the road network and overlays text boxes on the map that show information such as speed limits and detected violations.
Updated 16 days ago