接口地址
http://bus.wuhancloud.cn:9087/website/web/420100/line/027-905-1.do?Type=LineDetail
- 参数含义
- 420100 :湖北省武汉市身份证开头
- 027:湖北省武汉市区号
- 905:公交车编号
- 1:公交线路方向,取值为1、0
- Type:固定值LineDetail即可
接口请求方式
经过测试来看目前只支持GET的方式,POST不支持不过也不影响什么
接口返回结果
"resultCode": "1",
"resultDes": "",
"data": {
"lineName": "756",
"lineId": "027-756-1",
"lineNo": "756",
"direction": 1,
"startStopName": "高新二路佛祖岭一路",
"endStopName": "鲁磨路光谷广场",
"firstTime": "6:00",
"lastTime": "21:50",
"intervalTime": "",
"price": "1.0~2.0",
"lineTimes": "",
"stopsNum": 16,
"measure": 0.0,
"beBus": "2020-05-31 09:28:15",
"line2Id": "027-756-0",
"stops": [
{
"stopId": "027-I-4395",
"stopName": "高新二路佛祖岭一路",
"lng": 114.46288558217007,
"lat": 30.47577471173447,
"stopOrder": 1,
"metro": ""
},
{
"stopId": "027-452",
"stopName": "高新二路湖口",
"lng": 114.44790721449428,
"lat": 30.476505253267963,
"stopOrder": 2,
"metro": ""
},
{
"stopId": "027-2162",
"stopName": "高新二路姚家村",
"lng": 114.44220862552496,
"lat": 30.475708176399838,
"stopOrder": 3,
"metro": ""
},
{
"stopId": "027-1611",
"stopName": "高新二路光谷一路口",
"lng": 114.43923245435211,
"lat": 30.476471875207082,
"stopOrder": 4,
"metro": ""
},
{
"stopId": "027-1801",
"stopName": "光谷一路曾家垸",
"lng": 114.4374330365991,
"lat": 30.476901437274567,
"stopOrder": 5,
"metro": ""
},
{
"stopId": "027-1078",
"stopName": "光谷一路湖口湾",
"lng": 114.43756918891306,
"lat": 30.480649863039506,
"stopOrder": 6,
"metro": ""
},
{
"stopId": "027-886",
"stopName": "光谷一路天成美雅",
"lng": 114.43859154685285,
"lat": 30.4854432804167,
"stopOrder": 7,
"metro": ""
},
{
"stopId": "027-2023",
"stopName": "高新大道茶棚村",
"lng": 114.43682468449961,
"lat": 30.489437094278504,
"stopOrder": 8,
"metro": ""
},
{
"stopId": "027-2014",
"stopName": "高新大道茶棚",
"lng": 114.42970057659242,
"lat": 30.492035746286422,
"stopOrder": 9,
"metro": ""
},
{
"stopId": "027-91627",
"stopName": "高新大道BRT光谷大道站",
"lng": 114.42337733156188,
"lat": 30.49470538365406,
"stopOrder": 10,
"metro": ""
},
{
"stopId": "027-1778",
"stopName": "关山大道关山街",
"lng": 114.4124721485987,
"lat": 30.499362575165645,
"stopOrder": 11,
"metro": ""
},
{
"stopId": "027-156",
"stopName": "关山大道汽发社区",
"lng": 114.41305676905891,
"lat": 30.504865738330885,
"stopOrder": 12,
"metro": ""
},
{
"stopId": "027-508",
"stopName": "珞喻路关山口",
"lng": 114.41162777160059,
"lat": 30.507216913488463,
"stopOrder": 13,
"metro": ""
},
{
"stopId": "4201001164428030492545024",
"stopName": "珞喻路珞雄路",
"lng": 1830.5817,
"lat": 0.0,
"stopOrder": 14,
"metro": ""
},
{
"stopId": "027-648",
"stopName": "珞喻路光谷广场",
"lng": 114.40057926222842,
"lat": 30.50562377905755,
"stopOrder": 15,
"metro": ""
},
{
"stopId": "027-1851",
"stopName": "鲁磨路光谷广场",
"lng": 114.39987958339023,
"lat": 30.510660833965325,
"stopOrder": 16,
"metro": ""
}
],
"buses": [
"51769|12|2|0|114.44934075794922|30.476581744745307",
"51659|12|10|0|114.42557377976144|30.494011246838557",
"51773|12|14|0|114.4102950197295|30.507775545438598"
]
}
}
字段含义,自己分析的有些字段含义不清楚
- resultCode:一个返回结果标志,1、成功 2、失败。
- resultDes:失败的时候的描述
data:数据部分
lineName:公交线路编号
lineId:公交线路唯一标识
lineNo:线路编号
direction:线路方向
startStopName:起点站名称
endStopName:终点站名称
firstTime:首班时间
lastTime:末班时间
intervalTime:间隔时间
price:票价
lineTimes:未知
stopsNum:站点数
measure:路线长度
beBus:当前数据的获取时间不是接口调用时间
line2Id:另一条线路的唯一标识
buses:实时公交数据
stops:站点信息stopId:站点唯一标识
stopName:站点名称
lng:站点经度
lat:站点维度
stopOrder:当前线路站点编号
metro:未知
重点关注一下buses这个
"51769|12|2|0|114.44934075794922|30.476581744745307"
按“|”分隔之后
- 51769 这暂时不知道什么含义,像是公交的一个编号
- 12 这也不知道是个什么鬼,所有线路都是12
- 2 就是这个公交离得最近的公交站点和上面数据的stopOrder对应
- 0 已到站,还有另外一个值1即将到站
- 后面这个两个就是这个公交车的实时地理位置信息