Trace attributes
Available on the following API tiers:
Snap a sequence of GPS coordinates to the road network and get back attributes along the matched path, such as speed limits, road class, and surface type. To get a route with directions instead, use map matching.
POSThttps://transit.land/api/v2/routing/valhalla/trace_attributes
Match a sequence of coordinates to the road network and return attributes along the matched path, such as speed limits, road class, and surface type.
Request
Exampleexclude
YYYY-MM-DDTHH:MM, e.g. 2016-07-03T08:06.lat and lon parameters will be treated as the routing location and the display_lat and display_lon will be used to determine the side of street. Both display_lat and display_lon must be provided and valid to achieve the desired effect.
lat and lon parameters will be treated as the routing location and the display_lat and display_lon will be used to determine the side of street. Both display_lat and display_lon must be provided and valid to achieve the desired effect.
heading parameter. The default value is service configuration dependent (60 by default).
Exampleopposite
Exampleprimary
break.Examplebreak
YYYY-MM-DDTHH:MM, e.g. 2016-07-03T08:06.lat and lon parameters will be treated as the routing location and the display_lat and display_lon will be used to determine the side of street. Both display_lat and display_lon must be provided and valid to achieve the desired effect.
lat and lon parameters will be treated as the routing location and the display_lat and display_lon will be used to determine the side of street. Both display_lat and display_lon must be provided and valid to achieve the desired effect.
heading parameter. The default value is service configuration dependent (60 by default).
Exampleopposite
Exampleprimary
break.Examplebreak
no_shape is not valid for isochrone.Examplepolyline6
Examplewalk_or_snap
Exampleauto
YYYY-MM-DDTHH:MM, e.g. 2016-07-03T08:06. Required for types 1, 2, 3.YYYY-MM-DDTHH:MM, e.g. 2016-07-03T08:06.lat and lon parameters will be treated as the routing location and the display_lat and display_lon will be used to determine the side of street. Both display_lat and display_lon must be provided and valid to achieve the desired effect.
lat and lon parameters will be treated as the routing location and the display_lat and display_lon will be used to determine the side of street. Both display_lat and display_lon must be provided and valid to achieve the desired effect.
heading parameter. The default value is service configuration dependent (60 by default).
Exampleopposite
Exampleprimary
break.Examplebreak
YYYY-MM-DDTHH:MM, e.g. 2016-07-03T08:06.lat and lon parameters will be treated as the routing location and the display_lat and display_lon will be used to determine the side of street. Both display_lat and display_lon must be provided and valid to achieve the desired effect.
lat and lon parameters will be treated as the routing location and the display_lat and display_lon will be used to determine the side of street. Both display_lat and display_lon must be provided and valid to achieve the desired effect.
heading parameter. The default value is service configuration dependent (60 by default).
Exampleopposite
Exampleprimary
break.Examplebreak
[[lon,lat],…] or a GeoJSON FeatureCollection. Roads intersecting these rings will be avoided during path finding. Takes one of the 2 forms listed below.properties.levels array to restrict exclusion to specific building/indoor levels in pedestrian routing.geotiff is isochrone-only.Examplejson
"factor" property or a plain object with a "shape" key, whose value needs to be an encoded polyline (with 6 digit precision), and a "factor" key whose value needs to be float. Valhalla will perform an edge walk (see the map matching documentation for more info) to match the geometry onto edges and use those factors in costing. Edges with factors larger than 1 will be increasingly avoided, while edges with factors smaller than 1 increasingly favored.
Example request
curl -X POST "https://transit.land/api/v2/routing/valhalla/trace_attributes" \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"costing":"auto","shape":[{"lat":37.7891,"lon":-122.4011},{"lat":37.7887,"lon":-122.4016},{"lat":37.7883,"lon":-122.4022},{"lat":37.7879,"lon":-122.4028}],"shape_match":"map_snap"}'Response
edges of the edge this point matched.edges of the edge this point matched.Example response
Show response
{
"admins": [
{
"country_code": "US",
"country_text": "United States",
"state_code": "CA",
"state_text": "California"
}
],
"alternate_paths": [],
"confidence_score": 1,
"edges": [
{
"begin_heading": 224,
"begin_shape_index": 0,
"bicycle_network": 0,
"bridge": false,
"country_crossing": false,
"cycle_lane": "none",
"density": 13,
"drive_on_right": true,
"end_heading": 224,
"end_node": {
"admin_index": 0,
"elapsed_cost": 0.846,
"elapsed_time": 0.72,
"fork": false,
"intersecting_edges": [
{
"begin_heading": 315,
"cyclability": "backward",
"from_edge_name_consistency": false,
"road_class": "service_other",
"to_edge_name_consistency": false,
"use": "cycleway"
},
{
"begin_heading": 137,
"cyclability": "forward",
"from_edge_name_consistency": false,
"road_class": "service_other",
"to_edge_name_consistency": false,
"use": "cycleway"
}
],
"traffic_signal": false,
"transition_time": 0.008,
"type": "street_intersection"
},
"end_shape_index": 1,
"forward": true,
"id": 3854638373426,
"internal_intersection": false,
"lane_count": 1,
"length": 0.006,
"max_downward_grade": 0,
"max_upward_grade": 0,
"mean_elevation": 8,
"names": [
"Stevenson Street"
],
"road_class": "residential",
"roundabout": false,
"sac_scale": 0,
"shoulder": false,
"sidewalk": "none",
"speed": 30,
"speed_type": "classified",
"speeds_non_faded": {
"no_flow": 30
},
"surface": "paved_smooth",
"toll": false,
"traffic_signal": false,
"travel_mode": "drive",
"traversability": "both",
"truck_route": false,
"tunnel": false,
"unpaved": false,
"use": "road",
"vehicle_type": "car",
"way_id": 47172320,
"weighted_grade": 0
},
{
"begin_heading": 226,
"begin_shape_index": 1,
"bicycle_network": 0,
"bridge": false,
"country_crossing": false,
"cycle_lane": "none",
"density": 13,
"drive_on_right": true,
"end_heading": 226,
"end_node": {
"admin_index": 0,
"elapsed_cost": 1.551,
"elapsed_time": 1.328,
"fork": false,
"intersecting_edges": [
{
"begin_heading": 315,
"from_edge_name_consistency": false,
"road_class": "service_other",
"to_edge_name_consistency": false,
"use": "pedestrian_crossing",
"walkability": "both"
},
{
"begin_heading": 125,
"from_edge_name_consistency": false,
"road_class": "service_other",
"to_edge_name_consistency": false,
"use": "pedestrian_crossing",
"walkability": "both"
}
],
"traffic_signal": false,
"transition_time": 0.019,
"type": "street_intersection"
},
"end_shape_index": 2,
"forward": true,
"id": 3928021916210,
"internal_intersection": false,
"lane_count": 1,
"length": 0.005,
"max_downward_grade": 0,
"max_upward_grade": 0,
"mean_elevation": 8,
"names": [
"Stevenson Street"
],
"road_class": "residential",
"roundabout": false,
"sac_scale": 0,
"shoulder": false,
"sidewalk": "none",
"speed": 30,
"speed_type": "classified",
"speeds_non_faded": {
"no_flow": 30
},
"surface": "paved_smooth",
"toll": false,
"traffic_signal": false,
"travel_mode": "drive",
"traversability": "both",
"truck_route": false,
"tunnel": false,
"unpaved": false,
"use": "road",
"vehicle_type": "car",
"way_id": 47172320,
"weighted_grade": 0
},
{
"begin_heading": 225,
"begin_shape_index": 2,
"bicycle_network": 0,
"bridge": false,
"country_crossing": false,
"cycle_lane": "none",
"density": 13,
"drive_on_right": true,
"end_heading": 225,
"end_node": {
"admin_index": 0,
"elapsed_cost": 8.08,
"elapsed_time": 6.904,
"fork": false,
"traffic_signal": false,
"transition_time": 0,
"type": "street_intersection"
},
"end_shape_index": 3,
"forward": true,
"id": 3889434319410,
"internal_intersection": false,
"lane_count": 1,
"length": 0.046,
"max_downward_grade": 0,
"max_upward_grade": 1,
"mean_elevation": 8,
"names": [
"Stevenson Street"
],
"road_class": "residential",
"roundabout": false,
"sac_scale": 0,
"shoulder": false,
"sidewalk": "none",
"speed": 30,
"speed_type": "classified",
"speeds_non_faded": {
"no_flow": 30
},
"surface": "paved_smooth",
"target_percent_along": 0.701,
"toll": false,
"traffic_signal": false,
"travel_mode": "drive",
"traversability": "both",
"truck_route": false,
"tunnel": false,
"unpaved": false,
"use": "road",
"vehicle_type": "car",
"way_id": 47172320,
"weighted_grade": 0
}
],
"matched_points": [
{
"distance_along_edge": 0,
"distance_from_trace_point": 38.559444,
"edge_index": 0,
"lat": 37.788826,
"lon": -122.400826,
"type": "matched"
},
{
"distance_along_edge": 0.701669,
"distance_from_trace_point": 37.635989,
"edge_index": 2,
"lat": 37.788458,
"lon": -122.401297,
"type": "matched"
},
{
"lat": 37.7883,
"lon": -122.4022,
"type": "unmatched"
},
{
"lat": 37.7879,
"lon": -122.4028,
"type": "unmatched"
}
],
"osm_changeset": 189672781,
"raw_score": 200000096,
"shape": "shmagAtbwmhFnA`BbAxAjQnV",
"units": "kilometers"
}See the Routing Platform overview for API access, travel modes, and the machine-readable schema.
Reference: Valhalla map matching API reference