API 文档 / 路径规划 / 步行路径规划
步行路径规划
接口说明
步行路径规划
输入示例:起点:116.481028,39.989643;终点:116.434446,39.90816
返回示例:返回步行路线方案,包括步行距离、预计耗时和分段导航说明。
请求地址
GEThttps://cloud.dtbgis.com/api/v1/route/walking
鉴权方式
在 HTTP Header 中携带你的 API Key:
X-API-Key: 你的API-Key
每个 API Key 绑定已购接口与流量豆,调用成功扣减对应流量豆;调用失败(参数错误等)不扣流量豆。未开通该接口返回 403,流量豆不足返回 429。
请求参数
| 参数 | 必填 | 说明 | 示例 / 默认值 |
|---|---|---|---|
origin |
必填 | 起点坐标,格式 lon,lat | 116.481028,39.989643 |
destination |
必填 | 终点坐标,格式 lon,lat | 116.434446,39.90816 |
请求示例
curl -H "X-API-Key: 你的API-Key" \ "https://cloud.dtbgis.com/api/v1/route/walking?origin=116.481028%2C39.989643&destination=116.434446%2C39.90816"
import requests
resp = requests.get(
"https://cloud.dtbgis.com/api/v1/route/walking?origin=116.481028%2C39.989643&destination=116.434446%2C39.90816",
headers={"X-API-Key": "你的API-Key"},
)
print(resp.status_code, resp.json())
fetch("https://cloud.dtbgis.com/api/v1/route/walking?origin=116.481028%2C39.989643&destination=116.434446%2C39.90816", {
headers: { "X-API-Key": "你的API-Key" }
})
.then(r => r.json())
.then(console.log);
返回结果说明
本接口返回统一 JSON 信封结构:
{
"code": 200,
"msg": "success",
"data": { ... },
"quota_remaining": 9999
}| 字段 | 说明 |
|---|---|
code | 业务状态码,200 表示成功 |
msg | 状态描述,成功为 success |
data | 查询结果对象,字段见下方「data 字段说明」 |
quota_remaining | 本次调用后剩余可用流量豆数量 |
data 为高德原始 JSON 透传,坐标系 GCJ-02。示例中 polyline 坐标串做了截断示意。
响应示例
{
"code": 200,
"msg": "success",
"data": {
"status": "1",
"info": "OK",
"route": {
"origin": "116.481028,39.989643",
"destination": "116.434446,39.90816",
"paths": [
{
"distance": "10200",
"duration": "8400",
"steps": [
{
"instruction": "沿阜通东大街向西步行500米",
"orientation": "西",
"road": "阜通东大街",
"distance": "500",
"duration": "420",
"polyline": "116.481028,39.989643;116.478028,39.989643",
"action": "左转",
"assistant_action": "",
"walk_type": "0"
}
]
}
]
}
},
"quota_remaining": 9989
}
data 字段说明
| 字段 | 类型 | 说明 | 示例 |
|---|---|---|---|
status | string | 上游状态码,"1" 表示成功 | 1 |
info | string | 上游状态说明 | OK |
route | object | 路径规划结果对象 | — |
origin | string | 起点坐标(lng,lat) | 116.481028,39.989643 |
destination | string | 终点坐标(lng,lat) | 116.434446,39.908160 |
paths | array | 规划方案列表 | — |
distance | string | 方案总距离(米) | 1024 |
duration | string | 方案预计耗时(秒) | 820 |
steps | array | 方案分段指引列表 | — |
instruction | string | 分段步行指引文本 | 向西步行120米左转 |
orientation | string | 步行方向 | 西 |
road | string | 道路名称 | 阜通东大街 |
distance | string | 该段距离(米) | 120 |
duration | string | 该段预计耗时(秒) | 96 |
polyline | string | 该段坐标串(lng,lat;lng,lat) | 116.480,39.989;116.479,39.989 |
action | string | 导航主动作 | 左转 |
assistant_action | string | 导航辅助动作 | — |
walk_type | string | 人行道类型(0 普通 / 1 人行横道 等) | 0 |
错误码
错误以统一结构返回:{"detail": {"code": 429, "msg": "..."}}
| HTTP | 含义 | 常见原因 / 处理 |
|---|---|---|
400 | 参数错误 | 缺少必填参数或格式不合法 |
401 | 鉴权失败 | API Key 缺失、不存在、已停用或已过期 |
403 | 权限不足 | 该 API Key 未开通此接口,请购买流量豆 |
429 | 流量豆不足 / 限流 | 流量豆用完需续费;或超过速率(60 秒 200 次) |
404 | 资源不存在 | 路径错误,或查询对象无数据 |
503 | 服务暂时不可用 | 服务暂时异常,请稍后重试 |
完整错误码见 文档首页 · 错误码总览。