Bus/transfer
Zhangchao2 (讨论 | 贡献) (→使用示例) |
Zhangchao2 (讨论 | 贡献) |
||
第3行: | 第3行: | ||
== '''URL''' == | == '''URL''' == | ||
− | http://api. | + | http://api.t.sina.com.cn/location/bus/transfer.(json|xml) |
== '''支持格式''' == | == '''支持格式''' == | ||
第12行: | 第12行: | ||
== '''是否需要登录''' == | == '''是否需要登录''' == | ||
− | ''' | + | '''true''' |
== '''请求数限制''' == | == '''请求数限制''' == | ||
'''true''' | '''true''' | ||
第26行: | 第26行: | ||
| style="text-align:center;" |string | | style="text-align:center;" |string | ||
| 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份 | | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
|-style="color:red" | |-style="color:red" | ||
− | |colspan=4 | | + | |colspan=4 | 注意:以下两个参数至少选填一个 |
|- | |- | ||
| style="text-align:center;" |begin_id | | style="text-align:center;" |begin_id | ||
第41行: | 第36行: | ||
| style="text-align:center;" |begin_coordinate | | style="text-align:center;" |begin_coordinate | ||
| style="text-align:center;" |false | | style="text-align:center;" |false | ||
− | | style="text-align:center;" | | + | | style="text-align:center;" |string |
| 起点的坐标(逗号分隔,若有id以id为准) | | 起点的坐标(逗号分隔,若有id以id为准) | ||
|-style="color:red" | |-style="color:red" | ||
− | |colspan=4 | | + | |colspan=4 | 注意:以下两个参数至少选填一个 |
|- | |- | ||
| style="text-align:center;" |end_id | | style="text-align:center;" |end_id | ||
第53行: | 第48行: | ||
| style="text-align:center;" |end_coordinate | | style="text-align:center;" |end_coordinate | ||
| style="text-align:center;" |false | | style="text-align:center;" |false | ||
− | | style="text-align:center;" | | + | | style="text-align:center;" |string |
| 终点的坐标(逗号分隔,若有id以id为准) | | 终点的坐标(逗号分隔,若有id以id为准) | ||
|- style="color:red" | |- style="color:red" | ||
第69行: | 第64行: | ||
<pre> | <pre> | ||
<?xml version="1.0" encoding="UTF-8" ?> | <?xml version="1.0" encoding="UTF-8" ?> | ||
− | < | + | <geoResult> |
<status>1</status> | <status>1</status> | ||
<count>10</count> | <count>10</count> | ||
第113行: | 第108行: | ||
... | ... | ||
</transfers> | </transfers> | ||
− | </ | + | </geoResult> |
+ | |||
</pre> | </pre> | ||
第165行: | 第161行: | ||
... | ... | ||
] | ] | ||
− | } | + | } |
</pre> | </pre> | ||
=== '''字段说明 ''' === | === '''字段说明 ''' === | ||
− | : | + | :status:标识结果,1表示查询正常; |
:count:结果条数 | :count:结果条数 | ||
:type:查询类型(0:最快捷,1:最经济,2:最少换乘,3:最少步行,4:最舒适) | :type:查询类型(0:最快捷,1:最经济,2:最少换乘,3:最少步行,4:最舒适) | ||
第205行: | 第201行: | ||
<pre> | <pre> | ||
xml: | xml: | ||
− | http://api. | + | curl -u "username:password" "http://api.t.sina.com.cn/location/bus/transfer.xml?begin_coordinate=116.35442,39.88904&end_coordinate=116.34171,39.58904&source=appkey" |
− | http://api. | + | curl -u "username:password" "http://api.t.sina.com.cn/location/bus/transfer.xml?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey" |
json: | json: | ||
− | http://api. | + | curl -u "username:password" "http://api.t.sina.com.cn/location/bus/transfer.json?begin_coordinate=116.35442,39.88904&end_coordinate=116.34171,39.58904&source=appkey" |
− | http://api. | + | curl -u "username:password" "http://api.t.sina.com.cn/location/bus/transfer.json?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey" |
</pre> | </pre> |
2011年5月6日 (五) 23:58的版本
目录 |
公交换乘路线搜索
根据起始ID或坐标等进行搜索,返回公交换乘路线信息
URL
http://api.t.sina.com.cn/location/bus/transfer.(json%7Cxml)
支持格式
XML/JSON
HTTP请求方式
GET
是否需要登录
true
请求数限制
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份 |
注意:以下两个参数至少选填一个 | |||
begin_id | false | string | 起点的id(会覆盖begin_coordinate) |
begin_coordinate | false | string | 起点的坐标(逗号分隔,若有id以id为准) |
注意:以下两个参数至少选填一个 | |||
end_id | false | string | 终点的id(会覆盖end_coordinate) |
end_coordinate | false | string | 终点的坐标(逗号分隔,若有id以id为准) |
注意:以下参数选填 | |||
type | false | int | 查询类型(0:最快捷,1:最经济,2:最少换乘,3:最少步行,4:最舒适) |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <geoResult> <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> </geoResult>
JSON示例
{ "status":1, "count":"10", "type":0, "city":"0010", "begin_id":"P010A00CHR9", "end_id":"P010A00CWWJ", "end_coordinate":"116.2739,39.99957", "start_coordinate":"116.22074,39.90652", "extension_info":"0", "transfers": [ { "result_id":"1", "distance":"18534\u7c73", "expense":"0", "before_len":"160米", "last_len":"820" , "nav_count":"2" , "drive_coordinates":"116.21946,39.90754;116.21489,39.90751;...", "lines": [ { "seg_id":"1", "name":"598\u8def(\u897f\u9053\u53e3--\u516b\u5927\u5904)", "distance":"4470\u7c73", "last_len":"160\u7c73", "stop_num":"7", "stations": [ { "name":"\u4eac\u539f\u4e1c", "longitude":116.21946, "latitude":116.21946, "district":"", "station_info":"", "telephone":"", "address":"" }, ... ] }, ... ] }, ... ] }
字段说明
- status:标识结果,1表示查询正常;
- count:结果条数
- type:查询类型(0:最快捷,1:最经济,2:最少换乘,3:最少步行,4:最舒适)
- city:城市代码
- begin_id:起点id
- end_id:终点id
- end_coordinate:终点坐标
- start_coordinate:起点坐标
- extension_info:当前返回状态补充信息
- transfers:换乘方案列表
- result_id:结果类型(1为有结果,0为无结果)
- nav_count:导航段数
- distance:总距离
- before_len:之前需步行的距离
- last_len:最后还需步行的距离
- expense:花费(未使用)
- drive_coordinates:路线的坐标串
- station_info:上下车站的信息串
- lines:本方案中的导航段
- seg_id:导航段在本方案中的id
- name:导航段名称
- distance:本导航段距离
- last_len:本导航段结束后需要步行的距离
- stop_num:本导航段共有几站
- stations:本段从上车站到下车站的所有站点
- name:站名
- longitude:站点经度
- latitude:站点纬度
- district:区
- station_info:站点详情
- telephone:电话
- address:地址
使用示例
xml: curl -u "username:password" "http://api.t.sina.com.cn/location/bus/transfer.xml?begin_coordinate=116.35442,39.88904&end_coordinate=116.34171,39.58904&source=appkey" curl -u "username:password" "http://api.t.sina.com.cn/location/bus/transfer.xml?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey" json: curl -u "username:password" "http://api.t.sina.com.cn/location/bus/transfer.json?begin_coordinate=116.35442,39.88904&end_coordinate=116.34171,39.58904&source=appkey" curl -u "username:password" "http://api.t.sina.com.cn/location/bus/transfer.json?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey"