Bus/transfer
Zhangchao2 (讨论 | 贡献) (→请求参数) |
Zhangchao2 (讨论 | 贡献) (→XML示例) |
||
第68行: | 第68行: | ||
=== '''XML示例''' === | === '''XML示例''' === | ||
<pre> | <pre> | ||
− | <?xml version="1.0" encoding=" | + | <?xml version="1.0" encoding="UTF-8" ?> |
− | < | + | <geoSearchResult> |
− | + | <status>1</status> | |
− | + | <count>10</count> | |
− | + | <type>0</type> | |
− | < | + | <city>0010</city> |
− | < | + | <begin_id>P010A00CHR9</begin_id> |
− | < | + | <end_id>P010A00CWWJ</end_id> |
− | + | <end_coordinate>116.2739,39.99957</end_coordinate> | |
− | + | <start_coordinate>116.22074,39.90652</start_coordinate> | |
− | + | <extension_info>0</extension_info> | |
− | + | <transfers> | |
− | + | <transfer> | |
− | + | <result_id>1</result_id> | |
− | + | <distance>18534米</distance> | |
− | < | + | <expense>0</expense> |
− | < | + | <before_len>160米</before_len> |
− | + | <last_len>820</last_len> | |
− | + | <nav_count>2</nav_count> | |
− | + | <drive_coordinates>116.21946,39.90754;116.21489,39.90751;...</drive_coordinates> | |
− | + | <lines> | |
− | + | <line> | |
− | + | <seg_id>1</seg_id> | |
− | + | <name>598路(西道口--八大处)</name> | |
− | + | <distance>4470米</distance> | |
− | + | <last_len>160米</last_len> | |
− | + | <stop_num>7</stop_num> | |
− | + | <stations> | |
− | + | <station> | |
− | + | <name>京原东</name> | |
− | + | <longitude>116.21946</longitude> | |
− | + | <latitude>116.21946</latitude> | |
− | + | <district /> | |
− | + | <station_info /> | |
− | + | <telephone /> | |
− | + | <address /> | |
− | + | </station> | |
− | + | ... | |
− | + | </stations> | |
− | + | </line> | |
− | + | ... | |
− | + | </lines> | |
− | + | </transfer> | |
− | + | ... | |
− | + | </transfers> | |
− | + | </geoSearchResult> | |
− | + | ||
− | + | ||
− | + | ||
− | </ | + | |
</pre> | </pre> | ||
2011年3月23日 (三) 14:36的版本
目录 |
公交换乘路线搜索
根据起始ID或坐标等进行搜索,返回公交换乘路线信息
URL
http://api.t.sina.com.cn/bus/transfer.(json%7Cxml)
支持格式
XML/JSON
HTTP请求方式
GET
是否需要登录
false
请求数限制
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份 |
city | false | string | 所在城市代码,默认为0010(北京),(详见城市代码对照表) |
注意:以下参数至少选填一个 | |||
begin_id | false | string | 起点的id(会覆盖begin_coordinate) |
begin_coordinate | false | float | 起点的坐标(逗号分隔,若有id以id为准) |
注意:以下参数至少选填一个 | |||
end_id | false | string | 终点的id(会覆盖end_coordinate) |
end_coordinate | false | float | 终点的坐标(逗号分隔,若有id以id为准) |
注意:以下参数选填 | |||
type | false | int | 查询类型(0:最快捷,1:最经济,2:最少换乘,3:最少步行,4:最舒适) |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <geoSearchResult> <status>1</status> <count>10</count> <type>0</type> <city>0010</city> <begin_id>P010A00CHR9</begin_id> <end_id>P010A00CWWJ</end_id> <end_coordinate>116.2739,39.99957</end_coordinate> <start_coordinate>116.22074,39.90652</start_coordinate> <extension_info>0</extension_info> <transfers> <transfer> <result_id>1</result_id> <distance>18534米</distance> <expense>0</expense> <before_len>160米</before_len> <last_len>820</last_len> <nav_count>2</nav_count> <drive_coordinates>116.21946,39.90754;116.21489,39.90751;...</drive_coordinates> <lines> <line> <seg_id>1</seg_id> <name>598路(西道口--八大处)</name> <distance>4470米</distance> <last_len>160米</last_len> <stop_num>7</stop_num> <stations> <station> <name>京原东</name> <longitude>116.21946</longitude> <latitude>116.21946</latitude> <district /> <station_info /> <telephone /> <address /> </station> ... </stations> </line> ... </lines> </transfer> ... </transfers> </geoSearchResult>
JSON示例
{ "0": { "list": [{"seg_id":"1", "name":"\u8fd0\u901a112\u8def(\u53f2\u5404\u5e84--\u84dd\u9f99\u5bb6\u56ed)", "station":[{ "name":"\u9752\u9f99\u6865", "longitude":116.2685, "latitude":40.00547}, {"name":"\u897f\u9ec4\u6751\u5c0f\u533a", "longitude":116.19975, "latitude":39.93539}], "distance":"13283\u7c73", "last_len":"1600\u7c73", "stop_num":"19", "stop_name":"\u519b\u4e8b\u79d1\u5b66\u9662 \u53a2\u7ea2\u65d7 \u6797\u4e1a\u79d1\u5b66\u7814\u7a76\u9662 \u5a18\u5a18\u5e9c \u4e30\u6237\u8425 \u4e30\u6237\u8425\u897f \u6b63\u84dd\u65d7 \u9999\u6cc9\ u73af\u5c9b \u5367\u4f5b\u5bfa \u5317\u4eac\u690d\u7269\u56ed \u7ea2\u65d7\u6751 \u5357\u6cb3 \u6ee9\u5317\u5357\u6cb3\u6ee9 \u5317\u8f9b\u5e84 \u53cc\u65b0\u56ed \u5357\u8f9b\u5e84 \u5de8\u5c71 \u5317\u4eac\u5c04\u51fb\u573a \u897f\u4e0b\u5e84 ", "stop_coordinates":"116.26356,40.00602;116.2577,40.00596;......"}], "result_id":"1", "distance":"13283\u7c73", "expense":"0", "before_len":"1600\u7c73", "last_len":"320", "nav_count":"1", "drive_coordinates":"116.2685,40.00547;116.26703,40.00521;......", "station_info":"116.2685,40.00547,http:\/\/map.sina.com.cn\/icon\/begin.gif,5,\u9752\u9f99\u6865; 116.19975,39.93539,http:\/\/map.sina.com.cn\/icon\/end.gif,5,\u897f\u9ec4\u6751\u5c0f\u533a"}, ...... ,"count":"10", "status":1, "type":0, "city":"0010", "begin_id":46727, "end_id":5000, "end_coordinate":"116.19981,39.93248", "start_coordinate":"116.2739,39.99957", "extension_info":"0" }
字段说明
- status:标识结果;如该值为0,则没有找到相关的路线信息
- count:结果条数
- type:查询类型(0:最快捷,1:最经济,2:最少换乘,3:最少步行,4:最舒适)
- city:城市代码
- begin_id:起点id
- end_id:终点id
- end_coordinate:终点坐标
- start_coordinate:起点坐标
- extension_info:当前返回状态补充信息
- list:本方案中的导航段
- seg_id:导航段在本方案中的id
- name:导航段名称
- distance:本导航段距离
- last_len:本导航段结束后需要步行的距离
- stop_num:本导航段共有几站
- stop_name:本段停站的名称
- stop_coordinates:本段的各站的坐标
- station:本段上下车车站
- name:站名
- longitude:经度
- latitude:纬度
- result_id:结果类型(1为有结果,0为无结果)
- nav_count:导航段数
- distance:总距离
- before_len:之前需步行的距离
- last_len:最后还需步行的距离
- expense:花费(未使用)
- drive_coordinates:路线的坐标串
- station_info:上下车站的信息串
- list:本方案中的导航段
使用示例
xml: http://api.t.sina.com.cn/bus/transfer.xml?begin_coordinate=116.35442,39.88904&end_coordinate=116.34171,39.58904&source=appkey http://api.t.sina.com.cn/bus/transfer.xml?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey json: http://api.t.sina.com.cn/bus/transfer.json?begin_coordinate=116.35442,39.88904&end_coordinate=116.34171,39.58904&source=appkey http://api.t.sina.com.cn/bus/transfer.json?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey