Bus/line
Zhangchao2 (讨论 | 贡献) (→请求参数) |
Zhangchao2 (讨论 | 贡献) (→XML示例) |
||
第52行: | 第52行: | ||
=== '''XML示例''' === | === '''XML示例''' === | ||
<pre> | <pre> | ||
− | <?xml version="1.0" encoding=" | + | <?xml version="1.0" encoding="UTF-8" ?> |
− | < | + | <geoSearchResult> |
− | <count> | + | <count>4</count> |
<status>1</status> | <status>1</status> | ||
− | < | + | <lines> |
− | + | <line> | |
− | + | <result_id>1</result_id> | |
− | + | <city>0010</city> | |
− | + | <q>320路区间</q> | |
− | + | <rid>136</rid> | |
− | + | <coordinates>116.331676;39.986227;......</coordinates> | |
− | + | <name>320路区间(保福寺桥西--北京西站北广场)</name> | |
− | + | <front_name>保福寺桥西</front_name> | |
− | + | <front_spell>bao fu si qiao xi</front_spell> | |
− | + | <terminal_name>北京西站北广场</terminal_name> | |
− | + | <terminal_spell>bei jing xi zhan bei guang chang</terminal_spell> | |
− | + | <start_time>05:</start_time> | |
− | + | <end_time>23:</end_time> | |
− | + | <service_period /> | |
− | + | <time_desc /> | |
− | + | <company>北京公交集团第六客运分公司</company> | |
− | + | <length>13.2563</length> | |
− | + | <basic_price>1</basic_price> | |
− | + | <total_price>1</total_price> | |
− | + | <air>0</air> | |
− | + | <commutation_ticket>0</commutation_ticket> | |
− | + | <status>1</status> | |
− | + | <auto>1</auto> | |
− | + | <ic_card>1</ic_card> | |
− | + | <express_way>0</express_way> | |
− | + | <double_deck>0</double_deck> | |
− | + | <description>北京公交集团第六客运分公司</description> | |
− | + | <type>1</type> | |
− | + | <stations> | |
− | + | <station> | |
− | + | <name>保福寺桥西</name> | |
− | </ | + | <longitude>116.331676</longitude> |
− | </ | + | <latitude>39.98622</latitude> |
+ | <district>310100</district> | ||
+ | <station_info /> | ||
+ | <telephone /> | ||
+ | <address /> | ||
+ | </station> | ||
+ | ... | ||
+ | </stations> | ||
+ | </line> | ||
+ | ... | ||
+ | </lines> | ||
+ | </geoSearchResult> | ||
</pre> | </pre> | ||
2011年3月23日 (三) 14:59的版本
目录 |
公交线路搜索
根据线路关键字或城市代码等进行搜索,返回公交线路信息
URL
http://api.t.sina.com.cn/bus/line.(json%7Cxml)
支持格式
XML/JSON
HTTP请求方式
GET
是否需要登录
false
请求数限制
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份 |
q | true | string | 搜索关键字 |
city | false | string | 所在城市代码,默认为0010,(详见城市代码对照表) |
page | false | int | 返回结果的页码(默认为1) |
count | false | int | 单页返回的结果条数(默认为10,最大为40) |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <geoSearchResult> <count>4</count> <status>1</status> <lines> <line> <result_id>1</result_id> <city>0010</city> <q>320路区间</q> <rid>136</rid> <coordinates>116.331676;39.986227;......</coordinates> <name>320路区间(保福寺桥西--北京西站北广场)</name> <front_name>保福寺桥西</front_name> <front_spell>bao fu si qiao xi</front_spell> <terminal_name>北京西站北广场</terminal_name> <terminal_spell>bei jing xi zhan bei guang chang</terminal_spell> <start_time>05:</start_time> <end_time>23:</end_time> <service_period /> <time_desc /> <company>北京公交集团第六客运分公司</company> <length>13.2563</length> <basic_price>1</basic_price> <total_price>1</total_price> <air>0</air> <commutation_ticket>0</commutation_ticket> <status>1</status> <auto>1</auto> <ic_card>1</ic_card> <express_way>0</express_way> <double_deck>0</double_deck> <description>北京公交集团第六客运分公司</description> <type>1</type> <stations> <station> <name>保福寺桥西</name> <longitude>116.331676</longitude> <latitude>39.98622</latitude> <district>310100</district> <station_info /> <telephone /> <address /> </station> ... </stations> </line> ... </lines> </geoSearchResult>
JSON示例
{ "count":"1", "status":"1", "list":[{ "result_id":"1", "city":"0010", "station_info":";\u4fdd\u798f\u5bfa\u6865\u897f,116.331676 39.98622,bao fu si qiao xi,310100,1; \u4e2d\u5173\u6751\u4e00 \u8857,116.323349 39.9859,zhong guan cun yi jie,310100,2;", "q":"320\u8def\u533a\u95f4", "rid":"136", "coordinates":"116.331676;39.986227;......", "name":"320\u8def\u533a\u95f4(\u4fdd\u798f\u5bfa\u6865\u897f--\u5317\u4eac\u897f\u7ad9\u5317\u5e7f\u573a)", "front_name":"\u4fdd\u798f\u5bfa\u6865\u897f", "front_spell":"bao fu si qiao xi", "terminal_name":"\u5317\u4eac\u897f\u7ad9\u5317\u5e7f\u573a", "terminal_spell":"bei jing xi zhan bei guang chang", "start_time":"05:30", "end_time":"23:00", "service_period":"", "time_desc":"", "company":"\u5317\u4eac\u516c\u4ea4\u96c6\u56e2\u7b2c\u516d\u5ba2\u8fd0\u5206\u516c\u53f8", "length":"13.2563", "basic_price":"1", "total_price":"1", "air":"0", "commutation_ticket":"0", "status":"1", "auto":"1", "ic_card":"1", "express_way":"0", "double_deck":"0", "description":"\u5317\u4eac\u516c\u4ea4\u96c6\u56e2\u7b2c\u516d\u5ba2\u8fd0\u5206\u516c\u53f8", "type":"1"}] }
字段说明
- count:返回的结果数
- status:标识结果;如该值为0,则没有找到相关的路线信息
- list:返回的结果集
- result_id:结果id
- rid:线路数据id
- name:线路名称
- city:城市代码
- q:线路关键字
- front_name:起点名称
- front_spell:起点拼音
- terminal_name:终点名称
- terminal_name:终点拼音
- start_time:首班车时间
- end_time:末班时间
- service_period:区间
- time_desc:时间说明
- company:运营公司
- length:总长度
- basic_price:起步价
- total_price:全程票价
- air:是否有空调
- commutation_ticket:是否能使用月票
- status:状态
- auto:无人售票
- ic_card:是否能刷IC卡
- express_way:是否快车
- double_deck:是否双层车
- description:线路描述
- type:类型
- station_info:途径站点信息(格式:‘;’分隔,站名,经度 纬度,拼音,区域id,站点在本线路的序号)
- coordinates:线路坐标串(格式:’;’分隔,经度;纬度;经度;纬度;)
使用示例
xml: http://api.t.sina.com.cn/bus/line.xml?q=320&source=appkey json: http://api.t.sina.com.cn/bus/line.json?q=320&source=appkey