Snap To Roads API

Introduction

Nextbillion.ai Snap To Roads API takes a series of locations along a route, and returns the new locations on this route that are snapped to the best matched roads where the trip took place. You can set various parameters, such as timestamps or radiuses, to optimize the result.

Parameters

Loading...

Response Schema

Loading...

Query Limits

Nextbillion.ai allows a maximum rate limit of 6000 queries per minute or 100 queries/second for continuous requests.

Note: We can increase the quota if needed on request. Contact [email protected] for more details.

Examples

Sample GET API Request

https://api.nextbillion.io/snapToRoads/json?key=<insert_your_key_here>&path=41.38602272,2.17621539|41.38312885,2.17207083|41.38157854,2.17906668|41.38288511,2.18186215&interpolate=true&radiuses=25|25|25|25

Sample POST API Request

1https://api.nextbillion.io/snapToRoads/json?key={{api_key}}

POST Body Schema

Content Type: application/json

1{
2  "approaches": "string",
3  "avoid": "string",
4  "context": "string",
5  "geometry": "string",
6  "interpolate": true,
7  "key": "string",
8  "mode": "string",
9  "path": "Format: `lat0,lng0|lat1,lng1|...`",
10  "radiuses": "Unit: metres.\n\nFormat: `radius0|radius1|...`\n\n`20|30|21|55`",
11  "timestamps": "Unit: Unix epoch.\n\nFormat: `ts0|ts1|...`\n\n`1650438211|1650448111|1650438412`",
12  "tolerate_outlier": true
13}

Visual Representation

Sample API Response

1{
2   "status": "Ok",
3   "snappedPoints": [
4       {
5           "location": {
6               "latitude": 41.38596,
7               "longitude": 2.176129
8           },
9           "originalIndex": 0,
10           "distance": 10.0,
11           "name": "Via Laietana",
12           "bearing": 135.0
13       },
14       {
15           "location": {
16               "latitude": 41.383295,
17               "longitude": 2.172466
18           },
19           "originalIndex": 1,
20           "distance": 37.0,
21           "name": "Carrer de Petritxol",
22           "bearing": 0.0
23       },
24       {
25           "location": {
26               "latitude": 41.381503,
27               "longitude": 2.179009
28           },
29           "originalIndex": 2,
30           "distance": 9.0,
31           "name": "Calle del Regomir",
32           "bearing": 122.0
33       },
34       {
35           "location": {
36               "latitude": 41.382666,
37               "longitude": 2.181206
38           },
39           "originalIndex": 3,
40           "distance": 60.0,
41           "name": "Carrer de Joan Massana",
42           "bearing": 33.0
43       }
44   ],
45   "distance": 1560,
46   "geometry": [
47       "ger{Fy_hL`AuARRX?zAvB`BhC^[email protected]@[email protected]@tCcEa@[email protected]@hA[email protected]@}BIIvBwDgAeB}@[email protected]][email protected]@[email protected]@VoBmFgDkAaA"
48   ]
49}

API Error Codes

Response CodeDescriptionAdditional Notes
200Normal success case.Normal success case.
400Input validation failed.Such as missing parameter or parameter with invalid value type (for example value cannot be parsed into number).
401APIKEY not supplied or invalid.-
403APIKEY is valid but does not have access to requested resources.You might be querying for a geographical region which is not valid for your account, or requesting a service which is not enabled for you.
404Requested host/path not found.This error occurs when there is a malformed host name used.
422Could not process the request.There is an underlying map issue which prevents the processing of the request.
429Too many requests.QPM reached or API request count quota reached.
500Internal Service error.There was an internal issue with Nextbillion.ai services. You can reach out to [email protected] for an explanation.
Distance Matrix
Isochrone
DIDN'T FIND WHAT YOU LOOKING FOR?