接口描述
请求路径:https://mapapi-routes.apigw-gz.didiyunapi.com/api/v1/traffic/route
请求方法:GET Content-Type=application/json
输入参数
参数名称 | 必选 | 默认值 | 描述 |
---|---|---|---|
route | Route | 无 | 路线参数,经纬度小数点后不超过6位,至少输入3个点。 |
Route:
参数名称 | 必选 | 默认值 | 描述 |
---|---|---|---|
point | 是 | 无 | 路线上的坐标点 |
accuracy | 否 | 10 | 定位精度(单位米) |
speed | 否 | 3 | 速度(单位公里/小时) |
direction | 否 | 0 | 方向(0度代表正北,顺时针一周360度) |
输出参数
参数名称 | 类型 | 描述 |
---|---|---|
status | int | 状态码 |
info | string | 状态说明 |
result | Result | 请求返回数据 |
Result:
参数名称 | 类型 | 描述 |
---|---|---|
description | string | 路况综述 |
evaluation | Evaluation | 路况评价 |
steps | array<Steps> | 路况 |
expire_time | int | 过期时间(秒) |
Evaluation
参数名称 | 类型 | 描述 |
---|---|---|
expedite | int | 畅通所占百分比 |
congested | int | 缓行百分比 |
blocked | int | 拥堵百分比 |
unknown | int | 未知路段所占百分比 |
Steps
参数名称 | 类型 | 描述 |
---|---|---|
outline | string | 路段坐标点串 |
traffic_status | string | 交通状况,//0未知,1畅通,2缓行,3拥堵,4非常拥堵 |
speed | int | 速度(km/h) |
car_count | int | 小车通行个数 |
road_name | string | 道路名称 |
length | string | 道路段长度(米) |
错误码
示例
请求:
curl --location --request GET 'https://mapapi-routes.apigw-gz.didiyunapi.com/api/v1/traffic/route' \
--header 'Authorization: AppCode XXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"route": [
{
"point": "113.889210,22.520334",
"accuracy": 10,
"direction": 0
},
{
"point": "113.889194,22.520354",
"accuracy": 10,
"speed": 3
},
{
"point": "113.888960,22.520640",
"direction": 0
}
]
}'
输出:
{
"status": 0,
"info": "OK",
"result": {
"description": "",
"evaluation": null,
"steps": [
{
"outline": "113.895560,22.514020;113.895000,22.514550;113.894830,22.514700;113.894730,22.514790;113.894570,22.514930;113.894280,22.515180;113.894110,22.515320;113.892490,22.516780;113.892000,22.517280;113.891590,22.517690;113.891560,22.517720;113.891500,22.517780;113.890560,22.518730;113.889750,22.519670;113.889730,22.519700;113.889350,22.520160;113.889280,22.520250;113.888960,22.520640;113.888190,22.521690;113.887470,22.522750;113.887180,22.523230;113.886950,22.523640;113.886580,22.524260;113.886110,22.525120",
"traffic_status": 1,
"length": 1581,
"road_name": "S3",
"speed": 81.4,
"car_count": 8
}
],
"expire_time": 33797
}
}