Bus/line
Zhangchao2 (讨论 | 贡献) (→使用示例) |
Zhangchao2 (讨论 | 贡献) |
||
第3行: | 第3行: | ||
== '''URL''' == | == '''URL''' == | ||
− | http://api. | + | http://api.t.sina.com.cn/location/bus/line.(json|xml) |
== '''支持格式''' == | == '''支持格式''' == | ||
第12行: | 第12行: | ||
== '''是否需要登录''' == | == '''是否需要登录''' == | ||
− | ''' | + | '''true''' |
== '''请求数限制''' == | == '''请求数限制''' == | ||
'''true''' | '''true''' | ||
第40行: | 第40行: | ||
| style="text-align:center;" |false | | style="text-align:center;" |false | ||
| style="text-align:center;" |int | | style="text-align:center;" |int | ||
− | | | + | | 返回结果的页码(默认为1,最大为40) |
|- | |- | ||
| style="text-align:center;" |count | | style="text-align:center;" |count | ||
| style="text-align:center;" |false | | style="text-align:center;" |false | ||
| style="text-align:center;" |int | | style="text-align:center;" |int | ||
− | | | + | | 单页返回的结果条数(默认为10,最大为50) |
|} | |} | ||
第53行: | 第53行: | ||
<pre> | <pre> | ||
<?xml version="1.0" encoding="UTF-8" ?> | <?xml version="1.0" encoding="UTF-8" ?> | ||
− | < | + | <geoResult> |
<count>4</count> | <count>4</count> | ||
− | < | + | <page>1</page> |
<lines> | <lines> | ||
<line> | <line> | ||
− | |||
− | |||
<q>320路区间</q> | <q>320路区间</q> | ||
− | < | + | <city>0010</city> |
− | + | ||
<name>320路区间(保福寺桥西--北京西站北广场)</name> | <name>320路区间(保福寺桥西--北京西站北广场)</name> | ||
<front_name>保福寺桥西</front_name> | <front_name>保福寺桥西</front_name> | ||
第68行: | 第65行: | ||
<terminal_name>北京西站北广场</terminal_name> | <terminal_name>北京西站北广场</terminal_name> | ||
<terminal_spell>bei jing xi zhan bei guang chang</terminal_spell> | <terminal_spell>bei jing xi zhan bei guang chang</terminal_spell> | ||
− | <start_time>05:</start_time> | + | <start_time>05:00</start_time> |
− | <end_time>23:</end_time> | + | <end_time>23:00</end_time> |
<service_period /> | <service_period /> | ||
<time_desc /> | <time_desc /> | ||
第84行: | 第81行: | ||
<double_deck>0</double_deck> | <double_deck>0</double_deck> | ||
<description>北京公交集团第六客运分公司</description> | <description>北京公交集团第六客运分公司</description> | ||
− | <type>1</type> | + | <type>1</type> |
+ | <coordinates>116.331676;39.986227;......</coordinates> | ||
<stations> | <stations> | ||
<station> | <station> | ||
第100行: | 第98行: | ||
... | ... | ||
</lines> | </lines> | ||
− | </ | + | </geoResult> |
+ | |||
</pre> | </pre> | ||
第107行: | 第106行: | ||
{ | { | ||
"count":"4", | "count":"4", | ||
− | " | + | "page":"1", |
"lines": | "lines": | ||
[ | [ | ||
{ | { | ||
− | " | + | "q":"320\u8def\u533a\u95f4", |
"city":"0010", | "city":"0010", | ||
− | |||
− | |||
− | |||
"name":"320\u8def\u533a\u95f4(\u4fdd\u798f\u5bfa\u6865\u897f--\u5317\u4eac\u897f\u7ad9\u5317\u5e7f\u573a)", | "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_name":"\u4fdd\u798f\u5bfa\u6865\u897f", | ||
第138行: | 第134行: | ||
"description":"\u5317\u4eac\u516c\u4ea4\u96c6\u56e2\u7b2c\u516d\u5ba2\u8fd0\u5206\u516c\u53f8", | "description":"\u5317\u4eac\u516c\u4ea4\u96c6\u56e2\u7b2c\u516d\u5ba2\u8fd0\u5206\u516c\u53f8", | ||
"type":"1", | "type":"1", | ||
+ | "coordinates":"116.331676;39.986227;...", | ||
"stations": | "stations": | ||
[ | [ | ||
第155行: | 第152行: | ||
] | ] | ||
} | } | ||
+ | |||
</pre> | </pre> | ||
=== '''字段说明 ''' === | === '''字段说明 ''' === | ||
− | : | + | :count:当前返回的结果数 |
− | : | + | :page:当前返回的结果在总结果集中的页数 |
− | : | + | :lines:当前返回的结果集 |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
::q:线路关键字 | ::q:线路关键字 | ||
+ | ::city:城市代码 | ||
+ | ::name:线路名称 | ||
::front_name:起点名称 | ::front_name:起点名称 | ||
::front_spell:起点拼音 | ::front_spell:起点拼音 | ||
第200行: | 第196行: | ||
<pre> | <pre> | ||
xml: | xml: | ||
− | http://api. | + | curl -u "username:password" "http://api.t.sina.com.cn/location/bus/line.xml?q=320&source=appkey" |
json: | json: | ||
− | http://api. | + | curl -u "username:password" "http://api.t.sina.com.cn/location/bus/line.json?q=320&source=appkey" |
</pre> | </pre> |
2011年5月6日 (五) 23:59的版本
目录 |
公交线路搜索
根据线路关键字或城市代码等进行搜索,返回公交线路信息
URL
http://api.t.sina.com.cn/location/bus/line.(json%7Cxml)
支持格式
XML/JSON
HTTP请求方式
GET
是否需要登录
true
请求数限制
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份 |
q | true | string | 搜索关键字 |
city | false | string | 所在城市代码,默认为0010,(详见城市代码对照表) |
page | false | int | 返回结果的页码(默认为1,最大为40) |
count | false | int | 单页返回的结果条数(默认为10,最大为50) |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <geoResult> <count>4</count> <page>1</page> <lines> <line> <q>320路区间</q> <city>0010</city> <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:00</start_time> <end_time>23:00</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> <coordinates>116.331676;39.986227;......</coordinates> <stations> <station> <name>保福寺桥西</name> <longitude>116.331676</longitude> <latitude>39.98622</latitude> <district>310100</district> <station_info /> <telephone /> <address /> </station> ... </stations> </line> ... </lines> </geoResult>
JSON示例
{ "count":"4", "page":"1", "lines": [ { "q":"320\u8def\u533a\u95f4", "city":"0010", "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:", "end_time":"23:", "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", "coordinates":"116.331676;39.986227;...", "stations": [ { "name":"\u4fdd\u798f\u5bfa\u6865\u897f", "longitude":"116.331676", "latitude":"39.98622", "district":"310100", "station_info":"", "telephone":"", "address":"" }, ... ] }, ... ] }
字段说明
- count:当前返回的结果数
- page:当前返回的结果在总结果集中的页数
- lines:当前返回的结果集
- q:线路关键字
- city:城市代码
- name:线路名称
- 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:类型
- coordinates:线路坐标串(格式:’;’分隔,经度;纬度;经度;纬度;)
- stations:途径站点集
- name:站名
- longitude:站点经度
- latitude:站点纬度
- district:区
- station_info:站点详情
- telephone:电话
- address:地址
使用示例
xml: curl -u "username:password" "http://api.t.sina.com.cn/location/bus/line.xml?q=320&source=appkey" json: curl -u "username:password" "http://api.t.sina.com.cn/location/bus/line.json?q=320&source=appkey"