Route Matching
Problem: I have a noisy GPS trace. I need the road segments the vehicle actually drove, defensibly.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 isPOST /v8/match/routelinks.
Response walkthrough
Three keys plusMapVersion. 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.
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.
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 recordingMapVersion.
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.
Related
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.