Location/route
目录 |
Location/route
驾车路线查询接口。
URL
http://api.map.sina.com.cn/i/route.php
格式
xml
HTTP请求方式
GET
是否需要登录
true
请求数限制
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