Documentation menu
POST/trace_attributes
Access and price
| Auth | An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Needs a full key; a browser (maps) key is refused. |
|---|---|
| Price | 1 call per started block of 50 shape points or 300 encoded-polyline characters, whichever is more. Class: standard, or premium for truck and ADR work. Published as unit_rules.trace in /pricing.json. |
| Premium | When the body asks for truck routing: "costing": "truck", a top-level adr object or "hazmat": true |
What it does
Map matching to per-edge attributes.
An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Price: 1 call per started block of 50 shape points or 300 encoded-polyline characters, whichever is more.
Call it
curl -fsS -X POST "https://api.mapmap.ai/trace_attributes" \
-H "Authorization: Bearer $MAPMAP_KEY" \
-H "Content-Type: application/json" \
-d '{"costing":"auto","shape":[{"lat":51.5074,"lon":-0.1278},{"lat":51.509,"lon":-0.13}],"shape_match":"map_snap"}'Request body
application/json
Valhalla trace request JSON: shape (points) or encoded_polyline, costing, optional shape_match, filters and costing_options. MapMap adds way_positions (boolean, default false): each matched point gains way_id, way_offset_m (metres from the OpenStreetMap way's first node, in the way's own direction) and edge_offset_m, and each edge gains way_from_m and way_to_m (falling when the edge runs against the way). With filters, the attributes these need are let through and taken back off the answer.
Example: From website/public/docs/analysis.md:467
{
"costing": "auto",
"shape": [
{
"lat": 51.5074,
"lon": -0.1278
},
{
"lat": 51.509,
"lon": -0.13
}
],
"shape_match": "map_snap"
}Responses
| Field | Type | Required | Description |
|---|---|---|---|
| admins | object[] | no | Countries and states the matched path crosses, referenced by index from each edge. |
| alternate_paths | object[] | no | Other plausible matches, each in the same shape, when asked for. |
| confidence_score | number | no | The matcher's confidence in this match, 0 to 1. |
| edges | object[] | no | One entry per matched road edge: way_id, names, length,
speed, road_class, surface, headings, begin_shape_index
and end_shape_index, and the other attributes asked for. |
| matched_points | object[] | no | One entry per input point: where it snapped (lat, lon),
type (matched, interpolated or unmatched), edge_index
and distances. |
| osm_changeset | integer | no | OpenStreetMap changeset the routing graph was built from. |
| raw_score | number | no | The matcher's raw path score. |
| shape | string | no | The matched path, precision-6 encoded polyline. |
| units | string | no | Unit of the edge lengths, e.g. kilometers. |
Example: Recorded from the hosted gateway on 2026-11-05 with a test key: POST /trace_attributes with the request example; lists trimmed to their first items
{
"admins": [
{
"country_code": "GB",
"country_text": "United Kingdom",
"state_code": "ENG",
"state_text": "England"
}
],
"alternate_paths": [],
"confidence_score": 1,
"edges": [
{
"begin_heading": 307,
"begin_shape_index": 0,
"bicycle_network": 0,
"bridge": false,
"country_crossing": false,
"cycle_lane": "dedicated",
"density": 15,
"drive_on_right": false,
"end_heading": 307,
"end_node": {
"admin_index": 0,
"elapsed_cost": 2.894,
"elapsed_time": 2.362,
"fork": false,
"intersecting_edges": [
{
"begin_heading": 200,
"cyclability": "both",
"from_edge_name_consistency": false,
"road_class": "service_other",
"to_edge_name_consistency": false,
"use": "pedestrian_crossing",
"walkability": "both"
},
{
"begin_heading": 20,
"cyclability": "both",
"from_edge_name_consistency": false,
"road_class": "service_other",
"to_edge_name_consistency": false,
"use": "pedestrian_crossing",
"walkability": "both"
}
],
"time_zone": "Europe/London",
"traffic_signal": false,
"transition_time": 0.036,
"type": "street_intersection"
},
"end_shape_index": 3,
"forward": true,
"id": 23547728651216,
"internal_intersection": false,
"lane_count": 2,
"length": 0.021,
"max_downward_grade": -2,
"max_upward_grade": 0,
"mean_elevation": 16,
"names": [
"Trafalgar Square",
"A4"
],
"road_class": "primary",
"roundabout": false,
"sac_scale": 0,
"shoulder": false,
"sidewalk": "none",
"speed": 32,
"speed_limit": 32,
"speed_limit_type": "zone",
"speed_type": "tagged",
"speeds_non_faded": {
"no_flow": 32
},
"surface": "paved_smooth",
"toll": false,
"traffic_signal": true,
"travel_mode": "drive",
"traversability": "forward",
"truck_route": false,
"tunnel": false,
"unpaved": false,
"use": "road",
"vehicle_type": "car",
"way_id": 4369049,
"weighted_grade": -1.666
},
{
"begin_heading": 281,
"begin_shape_index": 3,
"bicycle_network": 0,
"bridge": false,
"country_crossing": false,
"cycle_lane": "dedicated",
"density": 15,
"drive_on_right": false,
"end_heading": 277,
"end_node": {
"admin_index": 0,
"elapsed_cost": 7.441,
"elapsed_time": 6.111,
"fork": false,
"time_zone": "Europe/London",
"traffic_signal": true,
"transition_time": 2,
"type": "street_intersection"
},
"end_shape_index": 7,
"forward": true,
"id": 23547896423376,
"internal_intersection": false,
"lane_count": 2,
"length": 0.032,
"max_downward_grade": 0,
"max_upward_grade": 4,
"mean_elevation": 16,
"names": [
"Trafalgar Square",
"A4"
],
"road_class": "primary",
"roundabout": false,
"sac_scale": 0,
"shoulder": false,
"sidewalk": "none",
"speed": 32,
"speed_limit": 32,
"speed_limit_type": "zone",
"speed_type": "tagged",
"speeds_non_faded": {
"no_flow": 32
},
"surface": "paved_smooth",
"toll": false,
"traffic_signal": false,
"travel_mode": "drive",
"traversability": "forward",
"truck_route": false,
"tunnel": false,
"unpaved": false,
"use": "road",
"vehicle_type": "car",
"way_id": 4369049,
"weighted_grade": 3.333
}
],
"matched_points": [
{
"distance_along_edge": 0,
"distance_from_trace_point": 19.223561,
"edge_index": 0,
"lat": 51.507289,
"lon": -0.128015,
"type": "matched"
},
{
"distance_along_edge": 0.542719,
"distance_from_trace_point": 13.693988,
"edge_index": 15,
"lat": 51.508881,
"lon": -0.129943,
"type": "matched"
}
],
"osm_changeset": 185661329,
"raw_score": 55.002,
"shape": "qdwfaB|_yF{AnCyA|Dk@pCc@`EYrGOhFOhFKdCIhBIhAg@`Cs@jBWtIc@dJ}ArWWlEGhAWnFaAnP}AlAaAr@cAF{@RaAJgAMuDgBgCqJqGmU}BnByNtM{T`KQyA_BkO",
"units": "kilometers"
}application/problem+json · Problem
unauthorized); the body carries signup, docs and a one-call hint for a free keyapplication/problem+json · Problem
X-PAYMENT). Not problem+jsonapplication/json · X402PaymentRequired
scope-insufficient), a request from an origin the key does not allow (origin-not-allowed), or an account restriction (forbidden)application/problem+json · Problem
text/plain
rate-limited, with Retry-After), or monthly quota exhausted with no payment path (quota-exceeded)application/problem+json · Problem
way_positions asked for on a deployment that cannot read the routing graph tiles (way-positions-not-enabled)application/problem+json · Problem
application/problem+json · Problem
request-timeout)application/problem+json · Problem
Error bodies follow the shared problem model documented on API conventions.
Also under Routing
Generated from https://api.mapmap.ai/openapi.json on 2026-11-12 · operationId post_trace_attributes