stringsearch接口
URL: |
http:// <BusServer-URL> / stringsearch |
父资源: |
BusServer |
[ 服务说明 ]
stringsearch 接口用于通过起点和终点的站点名称查询公交出行方案。
[ 参数说明 ]
[ 请求接口参数 ]
参数 | 参数说明 |
---|---|
start |
 参数是否必须:是  参数含义:起始公交站点的名称 |
end |
 参数是否必须:是  参数含义:终点公交站点的名称 |
sx |
 参数是否必须:否  参数含义:start 不能唯一确定站点时,sx 用于提供起始站点的经度 |
sy |
 参数是否必须:否  参数含义:start 不能唯一确定站点时,sy 用于提供起始站点的纬度 |
ex |
 参数是否必须:否  参数含义:end 不能唯一确定站点时,ex 用于提供终止站点的经度 |
ey |
 参数是否必须:否  参数含义:end 不能唯一确定站点时,ey 用于提供终止站点的纬度 |
ditie |
 参数是否必须:否  参数含义:布尔类型,表示是否乘坐地铁,默认为true(即乘坐地铁) |
num |
 参数是否必须:否  参数含义:表示返回方案的最大数目,可以不设,默认为5 |
[ 返回结果参数 ]
参数 | 参数说明 | ||||
state | 参数含义:状态,true 表示成功,false 表示失败 | ||||
describe | 参数含义:描述错误的原因 | ||||
needmoreinfo | 参数含义:表明当前条件不足,需要更多的条件 | ||||
startArray | name | 参数含义:与起点重名的站点名称 | |||
geom | type | 参数含义:地理对象的类型 | |||
coordinates | 参数含义:地理对象的空间坐标 | ||||
endArray | name | 参数含义:与终点重名的站点名称 | |||
geom | type | 参数含义:地理对象的类型 | |||
coordinates | 参数含义:地理对象的空间坐标 | ||||
total | 参数含义:实际返回方案的数目 | ||||
cases | id | 参数含义:方案的编号,从1 开始 | |||
transcount | 参数含义:换乘次数 | ||||
walkdis | 参数含义:总的步行距离,单位:米 | ||||
walktime | 参数含义:总的步行时间,单位:秒 | ||||
totaltime | 参数含义:总时间,单位:秒 | ||||
totaldis | 参数含义:总距离,单位:米 | ||||
steps | type | 参数含义:路段类型,包括walk、bus,分别表示步行、乘车路段 | |||
time | 参数含义:路段花费的时间,单位:秒 | ||||
dis | 参数含义:路段的距离,单位:米 | ||||
first | 参数含义:路段起点的名称 | ||||
last | 参数含义:路段终点的名称 | ||||
describe | 参数含义:路段的文字描述 | ||||
stopnum | 参数含义:仅对bus 路段有效,路段经过的站点数目 | ||||
busname | 参数含义:type 为bus 时,经过此路段的公交线路名称数组 | ||||
route | name | 参数含义:左侧route 内的结构描述的是 type=bus 时的情况,记录沿途经过的公交站点的名称及地理坐标; type=walk 时,route 记录一串详细描述步行路线的文字 | |||
geom | type | ||||
coordinates | |||||
origin | type | 参数含义:记录路段起点的经纬度 | |||
coordinates | |||||
destination | type | 参数含义:记录路段终点的经纬度 | |||
coordinates | |||||
geom | type | 参数含义:记录整个路段的坐标信息 | |||
coordinates |
[ 示例 ]
stringsearch请求接口示例:
http://127.0.0.1:8099/newmap/rest/services/%E5%85%AC%E4%BA%A4/changzhibus/BusServer/stringsearch?&start=%E6%9F%8F%E5%90%8E&end=%E5%85%AB%E4%B8%80%E5%AE%BE%E9%A6%86&ditie=true&num=5&format=json
[ 返回结果 ]
stringsearch操作成功时的返回结果示例 :
{"total":4,"state":true,"cases":[{"id":"1","transcount":0,"walkdis":667,"walktime":600,"totaltime":1833,"totaldis":2517,
"steps":[{"type":"walk","dis":667,"time":600,"first":"柏后站","last":"交警支队站","describe":"步行至交警支队站",
"route":"沿太行东街向西北方向走510米,左转,沿城东中路走160米,到达交警支队",
"origin":{"type":"Point","coordinates":[113.134981,36.19988511]},
"destination":{"type":"Point","coordinates":[113.1288762,36.19996575]},
"geom":{"type":"MultiLineString","coordinates":[[[113.1349015,36.19990803],[113.1348794,36.19982255]],[[113.1349015,36.19990803],[113.1338689,36.20017155]],[[113.1338689,36.20017155],
[113.1336841,36.20021773],[113.1335337,36.20025602]],[[113.1335337,36.20025602],[113.1328882,36.20042035],[113.1324753,36.20052644],[113.1322849,36.20057351]],[[113.1322849,36.20057351],
[113.132044,36.20063434]],[[113.132044,36.20063434],[113.1316352,36.20073753],[113.1315645,36.20075637]],[[113.1315645,36.20075637],[113.131486,36.2007762],[113.1310109,36.20089495],
[113.129986,36.20115424],[113.1295138,36.20127221]],[[113.1295138,36.20127221],[113.1291904,36.20051354],[113.1290991,36.20030202],[113.1289439,36.19993775]],[[113.1289439,36.19993775],[113.1288762,36.19996575]]]}},
{"type":"bus","dis":1850,"time":1233,"first":"交警支队站","last":"八一宾馆站","describe":"乘坐306路(下行)或902路(下行)经5站到八一宾馆站下车"...}]}
stringsearch操作失败时的返回结果示例 :
{
"state":false,"describe":"Missing 'start'Parameter"}
"state":false,"describe":"Missing 'start'Parameter"}