Snap to Road API FAQ
Q1. What is Snap to Roads API?
Snap To Roads API takes a series of locations and snaps them to nearby roads representing the best-matched route where a trip took place connecting all the given locations. Users can choose to retrieve a geometry of the route connecting all the points while using several other configurations. They can also choose to receive the segment-wise speed limits of the route identified in the response.
Q2. What are the mandatory parameters w.r.t NextBillion.ai’s Snap to Roads API?
You can use a basic GET request using the 2 required parameters, key and path, to obtain accurate road-snap data. you can further customise the request by including other optional parameters.
key | string | Format: 32 character alphanumeric string Example: key=API_KEY |
A key is a unique identifier that is required to authenticate a request to the API. |
path | string | Format: latitude_1,longitude_1|latitude_2,longitude_2|... Example: path=41.38602272,2.17621539|41.38312885,2.17207083|41.38157854,2.17906668|41.38288511,2.18186215 |
Pipe-separated list of coordinate points along a path which would be snapped to a road. |
Q3. How many locations can we use along the path to use Snap to Road API?
You can use the “path” parameter to use Pipe-separated list of coordinate points along a path which would be snapped to a road. You can use up to 200 coordinate points in the “path” parameter by using POST request. However, It is recommended to use the GET method when the number of coordinate points in the path parameter is less than 100.
Q4. What is the use of “radiuses” parameter?
This parameter allows you to snap the available road within a provided radius. You can provide radiuses in metres (m),
Please note, if no valid road is available within the specified radius, the API would snap the points to nearest, most viable road.
Please note, if no valid road is available within the specified radius, the API would snap the points to nearest, most viable road.
Q5. What is the default distance value for radius?
The default radius value while using SnapToRoad is 25 metres.
Note: If the number of radiuses in the request does not match the number of coordinates in 'path'. Response is generated using the default radius value for all locations.
Note: If the number of radiuses in the request does not match the number of coordinates in 'path'. Response is generated using the default radius value for all locations.
Q6. How to use timestamps with Snap to Roads API?
You can use Pipe-separated UNIX epoch timestamp in seconds for each location. The number of timestamps must be equal to the number of coordinate points in the path parameter.
The timestamps must increase monotonically starting from the first timestamp. This means that each subsequent timestamp should either be more than or equal to the preceding one.
The timestamps must increase monotonically starting from the first timestamp. This means that each subsequent timestamp should either be more than or equal to the preceding one.
Q7. Can we get the Speed limits for a particular route?
The “road_info” parameter allows you to receive segment-wise maximum speed information of the route returned in the request. max_speed is the only allowed value for this parameter.
“Max_speed” returns an array of objects containing maximum speed, in kilometres per hour, for each segment of the route. Each object represents one road segment.
Please note that returning speed information is a function of the “road_info” parameter, which is effective only when option=flexible is used in the request.
“Max_speed” returns an array of objects containing maximum speed, in kilometres per hour, for each segment of the route. Each object represents one road segment.
Please note that returning speed information is a function of the “road_info” parameter, which is effective only when option=flexible is used in the request.
Q8. What is the use of Tolerate_outlier parameter?
This parameter supports a boolean value to ignore any coordinate outside the service boundary.
When true, the service would ignore path coordinates points falling outside the accessible area, which otherwise would cause an error when this parameter is false.
When true, the service would ignore path coordinates points falling outside the accessible area, which otherwise would cause an error when this parameter is false.
Q9. What is the bearing parameter in the API response?
The bearing angle of the snapped point from the original point in radians. It indicates the direction of the snapped point
Q10. What are the API Methods available for Snap to Roads API?
Snap To Road API supports both HTTPS GET and POST methods. .
For GET Request, It is recommended to use it when the number of coordinate points in the path parameter is less than 100.
For POST Requests, the maximum number of path coordinate points allowed is 200.
For GET Request, It is recommended to use it when the number of coordinate points in the path parameter is less than 100.
For POST Requests, the maximum number of path coordinate points allowed is 200.