Directions

介绍

Nextbillion.ai 的 Directions API 可以用来计算两个地点间的路径,通过 Directions API 你可以:

  1. 找到起点到目标点的最佳路径。
  2. 通过设置不同的出行方式以获得更为精准的路径结果。[4w, pedestrian 等等]
  3. 你可以添加 waypoints(路径上需要经过的坐标)。
  4. 生成分段信息,如距离、速度和速度曲线。
  5. 生成转向时的指示信息。

完整的参数列表参见下一节的内容。

参数

请求参数

Loading...

响应数据

Loading...

范例

简单的 API Request

https://api.nextbillion.io/directions/json?origin=12.98740754,77.58327035&destination=12.95545688,77.61554269& session=R5mvdi&alternatives=false&altcount=1&annotations=false&approaches=unrestricted;unrestricted&avoid=& mode=4w&waypoints=12.973691,77.58824853&departure_time=1649144593&key=<insert your key here>

简单的 API Response

1{
2  "status": "Ok",
3  "mode": "4w",
4  "routes": [
5    {
6      "geometry": "mognA{}oxMMjAMr@CLFBXFVJb@PZJ@@`Ad@`Ah@NHXNt@h@t@s@^]^]Tm@Xm@\\s@J]@K@S@K@O@KDYBKFWH]La@BOPg@DMJ]F]@Q@iAD}@?_@AMAWO}@Mq@Kg@Q{@EUG[G[Ia@Ou@?AKe@G]EUDMCKAK@ILFh@Xf@VlBz@dAf@D@d@Tp@Z^PhAj@ZPf@VHDDBTL`@Pb@T^NTLNHd@Tx@`@h@VPHnAt@LHl@X@@dAh@d@TVLFCFCfChAdAeBr@iA~ByDPWZg@PYRYJKJMFIFI?CAG@GDOBEDEHEL?JBDBFH@M?]HUPUp@gATg@JYHa@??Dk@DaA?ADwAD{BAOCIEEQJa@La@Ba@A_@KSMGEWYM_@Ga@?a@FW@IP]HKPOZQBMDIDIHIr@qAb@_AXu@L[DOBQ@I@MBABCh@UjAMtB[r@MtCYNCPENEVGVGDEBG?GDSFURs@HWp@wBBIPi@Ro@Tq@J[Pq@DO@C?M@_@?K?q@Ag@?IAi@?KDK?O?G?KBY?G^cCDWDUBO?AJe@Ha@FWDSH[DSHe@Py@\\eB~ATH@d@Hb@FH@H@ZF\\D`ANTD\\Fb@FH@JANGNKCKOWe@{@Ye@CGEIKQMU]k@OW?AQWOQIK}@iASYfCw@f@OXKpDeAr@Ud@M`@Mp@SPGf@Of@Of@OJCPGPGBN@TxBDjAB?a@A{AAcA?A@c@@u@@W?Y@I@IDMFMBEDIBGBKF[@KJcAHq@BS@IO?EQAG?EQ{AKcAQ_Bu@yHAA?EEOEOXSTQNINKdAo@VQLKb@[HGl@c@dAu@LOtAiAh@_@VQxAgAVMFGNELBFCFAF?F?V@Z@^BxDRF?F@b@@bCPnAHB?nAH@OD_AFw@F}@Dy@Dw@JoBBYC?CACCAE?C@A@EBABAB?@I?CFaADk@Do@H@t@BP@d@@~@B@K?A?K@A@O@W@Q@O?ADe@N?n@Dv@DB?J?`@BL?d@BVBGhA?BtAB",
7      "distance": 7680.200000000001,
8      "duration": 1632.6999999999998,
9      "legs": [
10        {
11          "distance": {
12            "value": 2510
13          },
14          "duration": {
15            "value": 533
16          },
17          "steps": []
18        },
19        {
20          "distance": {
21            "value": 5169
22          },
23          "duration": {
24            "value": 1098
25          },
26          "steps": []
27        }
28      ]
29    }
30  ]
31}

API 错误号

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.

This error occurs when the wrong API key is passed in the request or the key is missing altogether

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
没找到你要找的内容?