Skip to main content

Route Matching

Problem: I have a noisy GPS trace. I need the road segments the vehicle actually drove, defensibly.
Reverse geocoding returns an address near a coordinate. It cannot tell you which road the vehicle drove and it will not survive an audit.These are different APIs solving different problems. Conflating them is common and it is how IFTA filings get disputed.

Prerequisites

  • A HERE API key with Route Matching entitlement
  • export HERE_API_KEY="..."
  • A trace: GPX, NMEA, CSV, or JSON
Route Matching v8 lives at routematching.hereapi.com.If you are reading a tutorial using m.fleet.ls.hereapi.com/2/matchroute.json, that is the legacy Fleet Telematics Route Matching API. Prefer v8 for new work.

The code

The trace is the request body. The endpoint is POST /v8/match/routelinks.

Response walkthrough

Three keys plus MapVersion. Abbreviated.
RouteLinks — the road segments, in order, gap-free. linkId is the join key. TracePoints — one per input point. linkIdMatched joins to RouteLinks. confidenceValue is per-point.
confidenceValue is the field that separates a defensible match from a guess.A dense interchange with sparse sampling produces several plausible interpretations. HERE tells you which points it was unsure about. Surface them. Do not persist a 0.4-confidence match as fact.
Warnings — traffic-rule violations and matching anomalies, when legal= is requested. Category 1010 is “vehicle stopped”; 1005 is a point moved onto the route. These are how you detect idle periods you should have segmented out before submitting. MapVersion — the single most important field on this page for compliance work.
For IFTA, the defensible artifact is: raw trace + matched links + MapVersion + match timestamp. Anything less is an assertion.A trip matched in March against map 17116 may match differently in September against a newer map. Both matches can be correct. Without recording which map produced which result, you cannot explain the discrepancy — and you will be asked to.

Common mistakes

Using reverse geocoding to reconstruct driven routes. Addresses, not segments. Matching packets instead of trips. Match on trip close. Submitting the parked portion of a trace. A vehicle idle for four hours emits thousands of points describing a parking space. Segment first. Not downsampling. Sub-second sampling adds cost and no information. Points out of temporal order. A trace is a sequence. Not persisting the raw trace. The matched output is a derivation. Not recording MapVersion. Ignoring confidenceValue. Low-confidence matches persisted as truth. Comparing GPS speed against the nearest road’s limit rather than the matched link’s. False violations on frontage roads parallel to highways. Matching in real time for retrospective reporting. Nothing is waiting. Batch it overnight. Blaming the matcher for a ten-minute sampling interval. Sampling rate is a device configuration decision that dominates every architectural one below it. No timeout headroom. HERE cancels waypoint requests exceeding roughly 50 seconds of computation.

Production considerations

Segment trips before matching. Detect start, stop, idle. Drop the parked portions. Downsample. In real telematics feeds this removes a substantial fraction of points at no information cost. Batch, overnight. Latency is worth nothing here and it costs money. Store the matched result. Re-matching for a report six months later bills again and may produce a different answer. Version against the map release. Non-negotiable for compliance. Use truck mode for trucks. mode=fastest;truck;traffic:disabled. A car-mode match against a truck’s trace produces links a truck could not legally traverse. Fix sampling rate at the device before tuning anything upstream.

Route Matching

Why map matching is inference, and where it goes wrong.

ELD Platform

HOS coupling, IFTA, and the audit artifact in full.

Vehicle Tracking

Ingesting GPS without touching an API per packet.

Reverse Geocode

What this is not.

HERE documentation

Placematic


Need production HERE API keys or implementation support? Placematic is an official HERE Technologies reseller and implementation partner. We have deployed HERE into production ELD systems. Talk to us.