How to detect speeding violations with GPS traces

HERE Route Matching API v8 can identify road segments where a driver exceeded the posted speed limit. The API matches GPS trace points to the road network, then returns the speed limit for each matched road link. You can compare that data against the GPS-recorded speed to flag violations.

For information on supported trace formats, see GPS trace file formats and accuracy requirements.

Sample request

Submit your GPS trace file as the POST request body. 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&'\
  'attributes=SPEED_LIMITS_FCn(FROM_REF_SPEED_LIMIT,TO_REF_SPEED_LIMIT),LINK_ATTRIBUTE_FCn(ISO_COUNTRY_CODE)&'\
  'apiKey=API_KEY'

The request uses the following key parameters:

ParameterValueDescription
routeMatch1Enables route matching mode. The API treats the input as a GPS trace and computes the most probable driven path.
modefastest;car;traffic:disabledSets the vehicle type to car and disables real-time traffic.
attributesSPEED_LIMITS_FCn(FROM_REF_SPEED_LIMIT,TO_REF_SPEED_LIMIT),LINK_ATTRIBUTE_FCn(ISO_COUNTRY_CODE)Requests the speed limit in both travel directions for each matched road link, along with the country code. Speed limits can vary by country, so the country code is useful for interpreting the limit values.

Response

For each matched road link, the API returns the speed limits and any applicable warnings. Warnings appear where the matched route includes a detected violation, such as speeding or traveling in a prohibited direction.

An example warning message:

Entering link 55527933 at 41.9004,12.46567 into forbidden driving direction

Try it

Explore this use case without writing code - see the interactive demo at https://demo.support.here.com/examples/v3/rme_basic.

📘

Note

You need a HERE platform account to access the demo.

  1. Open the demo link.
  2. Upload a trace file in CSV, GPX, or NMEA format, or click directly on the map to add GPS points manually. You can also choose one of the four supplied examples.
  3. The API matches your trace to the road network and overlays text boxes on road segments where a speed violation or driving anomaly was detected.