Location/route
Zhangchao2 (讨论 | 贡献) (→使用示例) |
Zhangchao2 (讨论 | 贡献) |
||
第23行: | 第23行: | ||
:o 示例: http://api.map.sina.com.cn/i/route.php?city1=0010&city2=0021&begin_id=46727&end_id=5000 | :o 示例: http://api.map.sina.com.cn/i/route.php?city1=0010&city2=0021&begin_id=46727&end_id=5000 | ||
*beginxy(endxy): 起(终)点的坐标(逗号分隔,若有id以id为准) | *beginxy(endxy): 起(终)点的坐标(逗号分隔,若有id以id为准) | ||
− | :o 示例: http://api.map.sina.com.cn/i/record.php?beginxy= | + | :o 示例: http://api.map.sina.com.cn/i/record.php?beginxy=116.35442,39.88904&endxy=116.34171,39.58904 |
*t: 查询类型(0:速度优先,1:费用优先,2:距离优先) | *t: 查询类型(0:速度优先,1:费用优先,2:距离优先) | ||
:o 示例: http://api.map.sina.com.cn/i/route.php?city1=0010&city2=0021&begin_id=46727&end_id=5000&t=1 | :o 示例: http://api.map.sina.com.cn/i/route.php?city1=0010&city2=0021&begin_id=46727&end_id=5000&t=1 | ||
第40行: | 第40行: | ||
<sDirection>南</sDirection> | <sDirection>南</sDirection> | ||
<roadName>吉市口路</roadName> | <roadName>吉市口路</roadName> | ||
− | <segline> | + | <segline>116.43755,39.92733;116.43757,39.92702</segline> |
<action /> | <action /> | ||
<accessInfo /> | <accessInfo /> | ||
<navSign /> | <navSign /> | ||
− | <\P> | + | <\P>116.43755,39.92733</\P> |
− | <next> | + | <next>116.43757,39.92702</next> |
</item> | </item> | ||
<item> | <item> | ||
第55行: | 第55行: | ||
<sDirection>西</sDirection> | <sDirection>西</sDirection> | ||
<roadName /> | <roadName /> | ||
− | <segline> | + | <segline>116.43757,39.92702;116.43757,39.92702;116.43704,39.92703;116.43463,39.92709</segline> |
<action>右转</action> | <action>右转</action> | ||
<accessInfo>无辅助动作</accessInfo> | <accessInfo>无辅助动作</accessInfo> | ||
<navSign /> | <navSign /> | ||
− | <\P> | + | <\P>116.43757,39.92702</\P> |
− | <next> | + | <next>116.43463,39.92709</next> |
</item> | </item> | ||
</list> | </list> | ||
第69行: | 第69行: | ||
<distance>26296</distance> | <distance>26296</distance> | ||
<time>30</time> | <time>30</time> | ||
− | <pathstr> | + | <pathstr>116.43755,39.92733;116.43757,39.92702;116.43757,39.92702;……</pathstr> |
− | <startxy> | + | <startxy>116.43755,39.92733</startxy> |
− | <endxy> | + | <endxy>116.19215,39.92640</endxy> |
<result>1</result> | <result>1</result> | ||
<type>0</type> | <type>0</type> | ||
第78行: | 第78行: | ||
=== 使用示例=== | === 使用示例=== | ||
需修改appkey | 需修改appkey | ||
− | *xml: curl -u username:password http://api.map.sina.com.cn/i/route.php?beginxy= | + | *xml: curl -u username:password http://api.map.sina.com.cn/i/route.php?beginxy=116.35442,39.88904&endxy=116.34171,39.58904&source=appkey |
2010年7月5日 (一) 17:57的版本
目录 |
Location/route
驾车路线查询接口。
URL
http://api.map.sina.com.cn/i/route.php
格式
xml
HTTP请求方式
GET
是否需要登录
false
请求数限制
true
请求参数
- city1(city2):起(终)点所在城市代码,默认为0010(北京)
- begin_id(end_id): 起(终)点的id(与city1(city2)结合使用,会覆盖beginxy(endxy))
- beginxy(endxy): 起(终)点的坐标(逗号分隔,若有id以id为准)
- t: 查询类型(0:速度优先,1:费用优先,2:距离优先)
返回结果
XML示例:(\P 标签 在实际返回结果中为 P 标签)
<?xml version="1.0" encoding="utf-8" ?> <xml> <list> <item> <seg_id>1</seg_id> <seg_Length>34</seg_Length> <roadSign>行驶时间;等级方向;坐标点;</roadSign> <sTime>1</sTime> <sGrade>主要道路</sGrade> <sDirection>南</sDirection> <roadName>吉市口路</roadName> <segline>116.43755,39.92733;116.43757,39.92702</segline> <action /> <accessInfo /> <navSign /> <\P>116.43755,39.92733</\P> <next>116.43757,39.92702</next> </item> <item> <seg_id>2</seg_id> <seg_Length>250</seg_Length> <roadSign>行驶时间;等级方向;坐标点;道路名称;</roadSign> <sTime>1</sTime> <sGrade>主要道路</sGrade> <sDirection>西</sDirection> <roadName /> <segline>116.43757,39.92702;116.43757,39.92702;116.43704,39.92703;116.43463,39.92709</segline> <action>右转</action> <accessInfo>无辅助动作</accessInfo> <navSign /> <\P>116.43757,39.92702</\P> <next>116.43463,39.92709</next> </item> </list> <statusInfo>0</statusInfo> <midsxy /> <total>11</total> <segNum>11</segNum> <distance>26296</distance> <time>30</time> <pathstr>116.43755,39.92733;116.43757,39.92702;116.43757,39.92702;……</pathstr> <startxy>116.43755,39.92733</startxy> <endxy>116.19215,39.92640</endxy> <result>1</result> <type>0</type> </xml>
使用示例
需修改appkey
- xml: curl -u username:password http://api.map.sina.com.cn/i/route.php?beginxy=116.35442,39.88904&endxy=116.34171,39.58904&source=appkey