Map matching / GPS trace snapping
POST/v2/route/match
Snaps a GPS trace to the road network using Valhalla's map-matching engine. Returns the matched route geometry, turn-by-turn steps, and divergence metrics.
Use cases:
- Route adherence — did a field agent follow the planned route?
- Trip verification — did the collection agent actually visit the borrower's hex zone?
- Mileage auditing — accurate distance from noisy GPS for reimbursement calculations
- Fraud detection — GPS trace that doesn't match a known road pattern is suspicious
The divergence_ratio is matched_distance / gps_distance. A ratio above ~1.3
suggests the agent went off-road or the GPS trace contains significant noise.
Limits: 2–500 trace points per request. Timestamps are optional but improve matching accuracy on complex intersections.
Request
Responses
- 200
- 400
- 404
- 422
- 503
Trace matched successfully
Fewer than 2 trace points or invalid request body
No matched route found for the supplied trace
Invalid coordinates or timestamp format
Routing service temporarily unavailable
Response Headers
Retry-After