Locate
Available on the following API tiers:
Report what the road network looks like near one or more coordinates: which edges a location would snap to, how far away they are, and what the graph knows about them. Useful for debugging routes.
GETPOSThttps://transit.land/api/v2/routing/valhalla/locate
Find the nearest road or path network locations for given coordinates. Useful for debugging why a route behaves the way it does.
Request
The request object, url-encoded. Identical to the POST body. Encode spaces as %20 rather than +, or send the JSON without spaces; a + is not decoded as a space here and the request will be rejected as unparseable.
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
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 --get "https://transit.land/api/v2/routing/valhalla/locate" \
-H "apikey: YOUR_API_KEY" \
--data-urlencode 'json={"costing":"auto","locations":[{"lat":37.7793,"lon":-122.4193}],"verbose":true}'Response
Example response
Show response
[
{
"edges": [
{
"access_restrictions": [],
"bounding_circle": {
"lat": 37.77919,
"lon": -122.419962,
"radius": 90
},
"correlated_lat": 37.779214,
"correlated_lon": -122.419983,
"distance": 60.8,
"edge": {
"access": {
"HOV": true,
"bicycle": true,
"bus": true,
"car": true,
"emergency": false,
"moped": true,
"motorcycle": true,
"pedestrian": true,
"taxi": true,
"truck": true,
"wheelchair": true
},
"access_restriction": false,
"bike_network": false,
"bridge": false,
"classification": {
"classification": "trunk",
"internal": false,
"link": false,
"surface": "paved_smooth",
"use": "road"
},
"country_crossing": false,
"cycle_lane": "none",
"deadend": false,
"destination_only": false,
"destination_only_hgv": false,
"end_node": {
"id": 4974,
"level": 0,
"tile_id": 2804,
"value": 166899767200
},
"end_restriction": {
"HOV": false,
"bicycle": false,
"bus": false,
"car": false,
"emergency": false,
"moped": false,
"motorcycle": false,
"pedestrian": false,
"taxi": false,
"truck": false,
"wheelchair": false
},
"forward": true,
"geo_attributes": {
"curvature": 3,
"length": 173,
"max_down_slope": 0,
"max_up_slope": 2,
"weighted_grade": 1.66
},
"has_sign": false,
"lane_count": 3,
"not_thru": false,
"part_of_complex_restriction": true,
"round_about": false,
"sac_scale": "none",
"sidewalk_left": false,
"sidewalk_right": false,
"speeds": {
"constrained_flow": 0,
"default": 40,
"free_flow": 0,
"predicted": false,
"type": "tagged"
},
"start_restriction": {
"HOV": false,
"bicycle": false,
"bus": false,
"car": false,
"emergency": false,
"moped": false,
"motorcycle": false,
"pedestrian": false,
"taxi": false,
"truck": false,
"wheelchair": false
},
"stop_sign": false,
"toll": false,
"traffic_signal": false,
"truck_route": true,
"tunnel": false,
"yield_sign": false
},
"edge_id": {
"id": 11635,
"level": 0,
"tile_id": 2804,
"value": 390405838752
},
"edge_info": {
"bike_network": {
"local": false,
"mountain": false,
"national": false,
"regional": false
},
"mean_elevation": 20,
"names": [
"US 101 North",
"Van Ness Avenue"
],
"shape": "k~x`gA~e|nhFg|@hKuI\\}V~C",
"speed_limit": 40,
"way_id": 502795544
},
"heading": 350.9,
"inbound_reach": 50,
"linear_reference": "K6jyJxrdWks/Av/hAJsLT4Q=",
"live_speed": {},
"outbound_reach": 50,
"percent_along": 0.51614,
"predicted_speeds": [],
"shoulder": false,
"side_of_street": "right"
}
],
"input_lat": 37.7793,
"input_lon": -122.4193,
"nodes": []
}
]See the Routing Platform overview for API access, travel modes, and the machine-readable schema.
Reference: Valhalla locate API reference