Location/bus/en

跳转到: 导航, 搜索

目录

Location/bus

Query API for busline.

URL

http://api.map.sina.com.cn/i/bus.php

Format

xml

HTTP Request Method

GET

Requires Authentication

false

Requests Count Limitation

true

Request Parameters

required parameters:

  • city:city code of starting point. Default is 0010 (Beijing)
o Usage: http://api.map.sina.com.cn/i/bus.php? city=0021

At least one of following parameters is required:

  • begin_id: starting point ID (use it with city. this parameter overwrites beginxy).
o Usage: http://api.map.sina.com.cn/i/bus.php?city=0010&begin_id=46727&end_id=5000
  • beginxy: coordinate of starting point (separated by comma)
o Usage: http://api.map.sina.com.cn/i/bus.php?beginxy=116.35442,39.88904&endxy=116.34171,39.58904

At least one of following parameters is required:

  • end_id: end point ID((use it with city, and this parameter overwrites beginxy).
o Usage: http://api.map.sina.com.cn/i/bus.php?city=0010& begin_id=46727&end_id=5000
  • endxy: corrdinate of end point (separated by comma)
o Usage: http://api.map.sina.com.cn/i/bus.php?beginxy=116.35442,39.88904&endxy=116.34171,39.58904

optional parameters:

  • t: query type (0: speed-first. 1 cost-first. 2 transfer-first. 3 walk-first 4. comfort-first
o Usage : http://api.map.sina.com.cn/i/bus.php?city=0010&begin_id=46727&end_id=5000&t=1

Response

XML Example: Tags explanation:

  • xml:root node
  • statusInfo:Status information
  • item : a busline item.
  • list: a list of busline
  • item: busline
  • seg_id: segment id.
  • name: name
  • viaDistance:
  • sfootLen:本导航段结束后需要步行的距离
  • viaStopNum:本导航段共有几站
  • stopName:本段停站的名称
  • stopCoordi:本段的各站的坐标
  • station:本段上下车车站
  • item:上下车车站信息(第一个为上车车站,第二个为下车车站)
    • name:站名
    • lo:经度
    • la:纬度
  • result_id:结果类型(1为有结果,0为无结果)
  • tcount:导航段数
  • distance:总距离
  • footLen:之前需步行的距离
  • footEndLen:最后还需步行的距离
  • expense:花费(未使用)
  • pathstr:路线的坐标串
  • stationstr:上下车站的信息串
  • count:结果条数
  • result:标识结果;如该值为0,则没有找到相关的路线信息
  • type:查询类型(0:最快捷,1:最经济,2:最少换乘,3:最少步行,4:最舒适)
  • city:城市代码
  • begin_id:起点id
  • end_id:终点id
  • endxy:终点坐标
  • startxy:起点坐标
  • bbusfrom:起点类别
  • ebusfrom:终点类别
<?xml version="1.0" encoding="utf-8" ?> 
<xml>
 <statusInfo>0</statusInfo> 
<item>
<list>
<item>
 <seg_id>1</seg_id> 
 <name>846路(翠福园小区--五路桥东)</name> 
 <viaDistance>10835米</viaDistance> 
 <sfootLen>330米</sfootLen> 
 <viaStopNum>17</viaStopNum> 
 <stopName>朝阳门内 朝内小街 东四路口东 美术馆东 沙滩路口西 故宫 北海 西安门 西四路口西 白塔寺 阜成门 阜成门外 展览路 阜外西口 甘家口东 白堆子 马神庙</stopName> 
 <stopCoordi>116.432327,39.924495,116.424118,39.9244225,116.419662,39.924415……  </stopCoordi> 
<station>
<item>
 <name>朝阳门外</name> 
 <lo>116.43831</lo> 
 <la>39.92441</la> 
</item>
<item>
 <name>航天桥东</name> 
 <lo>116.31499</lo> 
 <la>39.92399</la> 
</item>
</station>
</item>
<item>
 <seg_id>2</seg_id> 
 <name>645路(地铁北土城站--大峪)</name> 
 <viaDistance>10458米</viaDistance> 
 <sfootLen>0米</sfootLen> 
 <viaStopNum>8</viaStopNum> 
 <stopName>航天桥西 西钓鱼台 定慧寺西 阜永路口西 阜玉路口东 沙石路口东 龚村东口 晋元桥西 </stopName> 
<stopCoordi>116.305931,39.92407583333333,116.300552,39.924079166666665,116.282775,39.92437666666667,116.263572,39.924438333333335,116.255844,39.924953333333335,116.241546,39.9263,116.226692,39.924865,116.20269,39.924815833333334</stopCoordi> 
<station>
<item>
 <name>航天桥东</name> 
 <lo>116.31497</lo> 
 <la>39.92399</la> 
</item>
<item>
 <name>杨庄东</name> 
 <lo>116.19376</lo> 
 <la>39.92481</la> 
</item>
</station>
</item>
</list>
 <result_id>1</result_id> 
 <tcount>2</tcount> 
 <distance>21294米</distance> 
 <footLen>330米</footLen> 
 <footEndLen>180</footEndLen> 
 <expense>0</expense> 
 <pathstr>116.43831,39.92441;116.43771,39.92445;116.43631,39.92452;……</pathstr> 
 <stationstr>116.43831,39.92441,http://map.sina.com.cn/icon/begin.gif,5,朝阳门外;116.31499,39.92399,http://map.sina.com.cn/icon/transfer.gif,5,航天桥东;116.31497,39.92399,http://map.sina.com.cn/icon/transfer.gif,5,航天桥东;116.19376,39.92481,http://map.sina.com.cn/icon/end.gif,5,杨庄东</stationstr> 
</item>
 <state>0</state> 
 <total>10</total> 
 <count>10</count> 
 <result>1</result> 
 <type>0</type> 
 <city>0010</city> 
 <begin_id>46727</begin_id> 
 <end_id>5000</end_id> 
 <endxy>116.19368,39.92646</endxy> 
 <startxy>116.43789,39.92734</startxy> 
 <bbusfrom>网络科技</bbusfrom> 
 <ebusfrom>律师事务所</ebusfrom> 
</xml>

使用示例

需修改appkey

文档更新时间: 2011-01-24