对齐到道路
介绍
Nextbillion.ai Snap To Roads API接受一系列沿途的位置信息作为输入,它将会返回对齐当前旅行佳匹配道路的一系列位置信息。你可以设置各种参数,比如时间戳或者匹配半径,来优化结果。
你可以使用SDK中的内置方法来请求并渲染结果。如果必要的话,你也可以手动处理和可视化这些数据。
参数
Request 参数
Loading...Response Schema
Loading...例子
简单 API Request
https://api.nextbillion.io/snapToRoads/json?key={{api_key}}&path=41.375371501680604,2.1358108520507812|41.3753352 7276556,2.1364009380340576|41.375246713110485,2.1372538805007935|41.37543188316085,2.137919068336487|41. 37525878943418,2.138814926147461|41.375343323637296,2.1397966146469116|41.37491260059898,2.140027284622 1924|41.xxxxxxxxxxxxxxx,2.1400755643844604&interpolate=true×tamps={{cur-time}}|{{cur-time2}}|{{cur-time3}}|{{cu r-time4}}|{{cur-time5}}|{{cur-time6}}|{{cur-time7}}|{{cur-time8}}&radiuses=25|25|25|25|25|25|25|25
简单 API Response
1{
2 "status": "Ok",
3 "snappedPoints": [
4 {
5 "location": {
6 "latitude": 37.786766,
7 "longitude": -122.412333
8 },
9 "originalIndex": 0,
10 "distance": 4,
11 "name": "Shannon St",
12 "bearing": 0
13 },
14 {
15 "location": {
16 "latitude": 37.786766,
17 "longitude": -122.412333
18 },
19 "originalIndex": 1,
20 "distance": 4,
21 "name": "Shannon St",
22 "bearing": 0
23 },
24 {
25 "location": {
26 "latitude": 37.786766,
27 "longitude": -122.412333
28 },
29 "originalIndex": 4,
30 "distance": 4,
31 "name": "Shannon St",
32 "bearing": 0
33 },
34 {
35 "location": {
36 "latitude": 37.786766,
37 "longitude": -122.412333
38 },
39 "originalIndex": 5,
40 "distance": 4,
41 "name": "Shannon St",
42 "bearing": 0
43 },
44 {
45 "location": {
46 "latitude": 37.786766,
47 "longitude": -122.412333
48 },
49 "originalIndex": 6,
50 "distance": 4,
51 "name": "Shannon St",
52 "bearing": 0
53 },
54 {
55 "location": {
56 "latitude": 37.786766,
57 "longitude": -122.412333
58 },
59 "originalIndex": 7,
60 "distance": 4,
61 "name": "Shannon St",
62 "bearing": 0
63 }
64 ],
65 "distance": 0,
66 "geometry": ["ifseF`tcjV??????????"]
67}
API 错误码
Response Code | Description | Additional Notes |
---|---|---|
200 | Normal success case. | Normal success case. |
400 | Input validation failed. | Such as missing parameter or parameter with invalid value type (for example value cannot be parsed into number). |
401 | APIKEY not supplied or invalid. | This error occurs when the wrong API key is passed in the request or the key is missing altogether |
403 | APIKEY 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. |
404 | Requested host/path not found. | This error occurs when there is a malformed host name used. |
422 | Could not process the request. | There is an underlying map issue which prevents the processing of the request. |
429 | Too many requests. | QPM reached or API request count quota reached. |
500 | Internal Service error. | There was an internal issue with NextBillion.ai services. You can reach out to [email protected] for an explanation. |