match_trace
Snap a recorded GPS trace to the road network and say what it actually travelled over. Provide shape (2 to 2000 recorded points, oldest first) or encoded_polyline (the same trace as a polyline6 string) (not both) plus the costing it was travelled under: "auto" (default), "truck", "bicycle", "pedestrian" or "motor_scooter". Costing decides which roads the trace may match onto, so a walk matched as "auto" snaps to the carriageway rather than the footpath. Returns the matched path as geometry_polyline6 (the snapped roads, not your raw points) with its distance_m and duration_s, then the roll-ups: by_road_class and by_admin (distance and time, longest first), by_surface (distance), and toll, bridge and tunnel totals. This is how you turn a dashcam or telematics log into a report, which country and region the driving happened in, how much of it was motorway, how much was tolled, how much was unpaved. Honesty: the roll-ups are summed per matched road segment, so they need not add up to distance_m exactly, and segments the map records no surface or admin area for are left out of that breakdown rather than filed under a guess, an entry in by_admin with null codes is exactly that, counted and not attributed. Needs the MapMap gateway (GATEWAY_URL + GATEWAY_API_KEY); there is no direct-backend fallback.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| shape | No | The trace as an ordered list of recorded points, oldest first. Between 2 and 2000 points. Provide this or `encoded_polyline`. | |
| costing | No | Costing model the trace was travelled under: `auto` (default), `truck`, `bicycle`, `pedestrian` or `motor_scooter`. It decides which roads the trace may be matched onto, so a walked trace matched as `auto` snaps to the carriageway rather than the path. | |
| encoded_polyline | No | The trace as a Google encoded polyline with six digits of decimal precision (polyline6), the geometry `route` and `match_trace` themselves return. Provide this or `shape`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| toll | Yes | Tolled portion of the matched path. | |
| bridge | Yes | Bridge portion of the matched path. | |
| tunnel | Yes | Tunnel portion of the matched path. | |
| costing | Yes | Costing the trace was matched under. | |
| summary | Yes | One-line human summary of the match, for reading aloud. | |
| by_admin | Yes | Distance and time by administrative area, longest first. An entry whose codes are all null covers segments the graph could not place in any admin area, counted honestly rather than guessed at. | |
| by_surface | Yes | Distance by road surface (`paved`, `paved_smooth`, `gravel`, …), longest first. Empty when the graph records no surface for any matched segment. | |
| distance_m | Yes | Length of the matched path in metres. | |
| duration_s | Yes | Travel time along the matched path in seconds, from the engine's own time model. | |
| edge_count | Yes | How many road segments the trace matched onto. | |
| by_road_class | Yes | Distance and time by road class (`motorway`, `primary`, `residential`, …), longest first. | |
| geometry_polyline6 | Yes | The matched path as a Google encoded polyline with six digits of decimal precision (polyline6). This is the trace snapped to real roads, not the raw input. |