接口功能文档
公交路线规划
http://api.map.baidu.com/direction/v2/transit?origin=40.056878,116.30815&destination=31.222965,121.505821&ak=您的AK
公交规划请求参数
字段名称
字段含义
字段类型
备注
origin
起点
"double,double",格式为:纬度,经度,小数点后不超过6位,如:“40.056878,116.30815”
必填
destination
终点
同上
同上
coord_type
起终点的坐标类型
string
可选,默认为bd09ll
可选值:
bd09ll(百度经纬度坐标)
gcj02(国测局加密坐标)
wgs84(gps 设备获取的坐标)
tactics_incity
市内公交换乘策略
int(0-5)
可选,默认为0
可选值:
0 推荐
1 少换乘
2 少步行
3 不坐地铁
4 时间短
5 地铁优先
tactics_intercity
跨城公交换乘策略
int(0-2)
可选,默认为0
可选值:
0 时间短
1 出发早
2 价格低
trans_type_intercity
跨城交通方式策略
int(0-2)
可选,默认为0
可选值:
0 火车优先
1 飞机优先
2 大巴优先
ret_coordtype
返回值的坐标类型
string
可选,默认为百度经纬度坐标:bd09ll
可选值:
bd09ll:百度经纬度坐标
gcj02:国测局坐标
output
输出类型
string
可选,默认为json
可选值:
json
xml
page_size
返回每页几条路线
int(1-10)
可选,默认为10
page_index
返回第几页
int
可选,默认为1
ak
开发者密钥,AK申请
string
必填
sn
用户的权限签名,当AK设置为SN校验时,该参数必填
SN计算方法
string
可选
timestamp
时间戳,与SN配合使用
string
可选,SN存在时必填。
callback
回调函数,用于解决浏览器请求跨域问题
string
可选,仅在 output=json时该参数有效。
公交规划返回参数
字段名称
字段含义
字段类型
备注
status
状态码
int
0:成功
1:服务器内部错误
2:参数无效
1001:没有公交方案
1002:没有匹配的POI
message
状态码对应的信息
string
result
返回的结果
dict
如果status为1001 或1002,此字段为null
origin
city_id
起点城市ID
string
city_name
起点城市名称
string
location
lng
起点坐标的经度值
double
坐标系由ret_coordtype设置
lat
终点坐标的纬度值
double
destination
city_id
终点城市ID
string
city_name
终点城市名称
string
location
lng
终点坐标的经度值
double
坐标系由ret_coordtype设置
lat
终点坐标的纬度值
double
taxi
detail
出租车的详细信息
array
仅在同城请求时才返回
desc
白天还是夜间
string
km_price
每公里价格(元)
double
start_price
起步价(元)
double
total_price
总价(元)
double
distance
出租车预计里程数
int
duration
出租车预计耗时
int
remark
出租车备注信息
string
total
所有路线的总数
int
符合条件的所有routes 的总数
routes
每页page_size 条,第page_index页的路线
array
请求中指定的page_index 和page_size 的部分。数组元素个数为page_size,每个元素代表从起点到终点的一条路线。
distance
本条路线的总距离(米)
int
duration
本条路线的总耗时(秒)
int
arrive_time
本条路线预计到达时间
string
格式为2016-04-05 17:06:10
price
本条路线的总票价(元)
double
非大陆地区此字段值为null<