Navigation/route
Zhangchao2 (讨论 | 贡献) (→URL) |
Zhangchao2 (讨论 | 贡献) |
||
第3行: | 第3行: | ||
== '''URL''' == | == '''URL''' == | ||
− | http://api. | + | http://api.t.sina.com.cn/location/navigation/route.(json|xml) |
== '''支持格式''' == | == '''支持格式''' == | ||
第12行: | 第12行: | ||
== '''是否需要登录''' == | == '''是否需要登录''' == | ||
− | ''' | + | '''true''' |
== '''请求数限制''' == | == '''请求数限制''' == | ||
'''true''' | '''true''' | ||
第27行: | 第27行: | ||
| 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。 | | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。 | ||
|-style="color:red" | |-style="color:red" | ||
− | |colspan=4 | | + | |colspan=4 | 注意:以两个参数至少选填一个 |
|- | |- | ||
| style="text-align:center;" |begin_id | | style="text-align:center;" |begin_id | ||
| style="text-align:center;" |false | | style="text-align:center;" |false | ||
| style="text-align:center;" |string | | style="text-align:center;" |string | ||
− | | | + | | 起点的id(会覆盖begin_coordinate) |
|- | |- | ||
| 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;" |float | | style="text-align:center;" |float | ||
− | | | + | | 起点的坐标(经纬度用逗号分隔,若有id以id为准) |
|-style="color:red" | |-style="color:red" | ||
− | |colspan=4 | | + | |colspan=4 | 注意:以下两个参数至少选填一个 |
|- | |- | ||
| style="text-align:center;" |end_id | | style="text-align:center;" |end_id | ||
| style="text-align:center;" |false | | style="text-align:center;" |false | ||
| style="text-align:center;" |string | | style="text-align:center;" |string | ||
− | | | + | | 终点的id(会覆盖end_coordinate) |
|- | |- | ||
| 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为准) |
|- style="color:red" | |- style="color:red" | ||
|colspan=4 | 注意:以下参数选填 | |colspan=4 | 注意:以下参数选填 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| style="text-align:center;" |type | | style="text-align:center;" |type | ||
| style="text-align:center;" |false | | style="text-align:center;" |false | ||
| style="text-align:center;" |int | | style="text-align:center;" |int | ||
− | | | + | | 查询类型(0:速度优先,1:费用优先,2:距离优先,默认为0) |
|} | |} | ||
第69行: | 第64行: | ||
<pre> | <pre> | ||
<?xml version="1.0" encoding="UTF-8" ?> | <?xml version="1.0" encoding="UTF-8" ?> | ||
− | < | + | <?xml version="1.0" encoding="UTF-8" ?> |
− | + | <geoResult> | |
<type>0</type> | <type>0</type> | ||
<total>13</total> | <total>13</total> | ||
第98行: | 第93行: | ||
... | ... | ||
</roads> | </roads> | ||
− | </ | + | </geoResult> |
</pre> | </pre> | ||
=== '''JSON示例''' === | === '''JSON示例''' === | ||
<pre> | <pre> | ||
− | { | + | { |
"type":0, | "type":0, | ||
"total":"13", | "total":"13", | ||
第133行: | 第128行: | ||
=== '''字段说明 ''' === | === '''字段说明 ''' === | ||
− | : | + | :type:查询类型,标识当前的结果是距离优先、速度优先,费用优先; |
− | + | :total:此次驾车路线所经过的路段总数; | |
− | + | ||
− | :total:此次驾车路线所经过的路段总数; | + | |
:time:驾车时间; | :time:驾车时间; | ||
− | : | + | :distance:驾车距离; |
+ | :drive_coordinates:驾车路线坐标 | ||
+ | :pass_coordinates:途经点坐标;; | ||
:start_coordinate:起点坐标; | :start_coordinate:起点坐标; | ||
− | : | + | :end_coordinate:终点坐标; |
+ | :extension_info:当前返回状态补充信息; | ||
:roads节点:该节点包含n个road节点 | :roads节点:该节点包含n个road节点 | ||
− | :: | + | ::rid表示当前路段的id,是标识该路段; |
+ | ::road_name:当前路段名称;如北四环西路辅路; | ||
+ | ::coordinates:当前道路坐标信息; | ||
+ | ::begin_coordinate:该路段的第一个坐标; | ||
+ | ::end_coordinate:该路段的最后的一个坐标 | ||
::road_length:表示当前路段的长度; | ::road_length:表示当前路段的长度; | ||
+ | ::action:当前行驶动作,如“右转”进入...向...行驶;标识右转动作; | ||
::road_sign:道路标识; | ::road_sign:道路标识; | ||
::run_time:在该路段运行时间; | ::run_time:在该路段运行时间; | ||
::grade:标识主要道路或次要道路等; | ::grade:标识主要道路或次要道路等; | ||
::direction:标识当前路段后,向哪个方向行驶,如向“东”行行驶; | ::direction:标识当前路段后,向哪个方向行驶,如向“东”行行驶; | ||
− | |||
− | |||
− | |||
::assist_info:标识当前是否有无辅助动作,是对action的一个补充;如右转后,到达出口再进入...向...行驶。 这里的“到达出口”即为辅助动作,如果没有辅助动作该标签内容为“无辅助动作”。又如“到达收费站”也为辅助动作; | ::assist_info:标识当前是否有无辅助动作,是对action的一个补充;如右转后,到达出口再进入...向...行驶。 这里的“到达出口”即为辅助动作,如果没有辅助动作该标签内容为“无辅助动作”。又如“到达收费站”也为辅助动作; | ||
::navigation_tag :导航标签; | ::navigation_tag :导航标签; | ||
− | |||
− | |||
== '''使用示例''' == | == '''使用示例''' == | ||
<pre> | <pre> | ||
xml: | xml: | ||
− | http://api. | + | curl -u "username:password" "http://api.t.sina.com.cn/location/navigation/route.xml?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey" |
json: | json: | ||
− | http://api. | + | curl -u "username:password" "http://api.t.sina.com.cn/location/navigation/route.json?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey" |
</pre> | </pre> |
2011年5月6日 (五) 23:57的版本
目录 |
驾车路线查询
根据ID或坐标等进行查询,返回驾车路线信息
URL
http://api.t.sina.com.cn/location/navigation/route.(json%7Cxml)
支持格式
XML/JSON
HTTP请求方式
GET
是否需要登录
true
请求数限制
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。 |
注意:以两个参数至少选填一个 | |||
begin_id | false | string | 起点的id(会覆盖begin_coordinate) |
begin_coordinate | false | float | 起点的坐标(经纬度用逗号分隔,若有id以id为准) |
注意:以下两个参数至少选填一个 | |||
end_id | false | string | 终点的id(会覆盖end_coordinate) |
end_coordinate | false | string | 终点的坐标(经纬度用逗号分隔,若有id以id为准) |
注意:以下参数选填 | |||
type | false | int | 查询类型(0:速度优先,1:费用优先,2:距离优先,默认为0) |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?> <geoResult> <type>0</type> <total>13</total> <time>24</time> <distance>16601</distance> <drive_coordinates>116.22106,39.90652;116.22106,39.90594;......</drive_coordinates> <pass_coordinates /> <start_coordinate>116.22106,39.90652</start_coordinate> <end_coordinate>116.27505,40.00236</end_coordinate> <extension_info>0</extension_info> <roads> <road> <rid>1</rid> <road_name>银河大街</road_name> <coordinates>116.22106,39.90652;116.22106,39.90594</coordinates> <begin_coordinate>116.22106,39.90652</begin_coordinate> <end_coordinate>116.22106,39.90594</end_coordinate> <road_length>64</road_length> <action /> <road_sign>行驶时间;等级方向;坐标点;道路名称;</road_sign> <run_time>1</run_time> <grade>主要道路</grade> <direction>南</direction> <assist_info /> <navigation_tag /> </road> ... </roads> </geoResult>
JSON示例
{ "type":0, "total":"13", "time":"24", "distance":"16601", "drive_coordinates":"116.22106,39.90652;116.22106,39.90594;......", "pass_coordinates":"", "start_coordinate":"116.22106,39.90652", "end_coordinate":"116.27505,40.00236", "extension_info":"0", "roads":[{ "rid":"1", "road_name":"\u94f6\u6cb3\u5927\u8857", "coordinates":"116.22106,39.90652;116.22106,39.90594", "begin_coordinate":"116.22106,39.90652", "end_coordinate":"116.22106,39.90594", "road_length":"64", "action":null, "road_sign":"\u884c\u9a76\u65f6\u95f4;\u7b49\u7ea7\u65b9\u5411;\u5750\u6807\u70b9;\u9053\u8def\u540d\u79f0;", "run_time":"1", "grade":"\u4e3b\u8981\u9053\u8def", "direction":"\u5357", "assist_info":null, "navigation_tag":null} ... ] }
字段说明
- type:查询类型,标识当前的结果是距离优先、速度优先,费用优先;
- total:此次驾车路线所经过的路段总数;
- time:驾车时间;
- distance:驾车距离;
- drive_coordinates:驾车路线坐标
- pass_coordinates:途经点坐标;;
- start_coordinate:起点坐标;
- end_coordinate:终点坐标;
- extension_info:当前返回状态补充信息;
- roads节点:该节点包含n个road节点
- rid表示当前路段的id,是标识该路段;
- road_name:当前路段名称;如北四环西路辅路;
- coordinates:当前道路坐标信息;
- begin_coordinate:该路段的第一个坐标;
- end_coordinate:该路段的最后的一个坐标
- road_length:表示当前路段的长度;
- action:当前行驶动作,如“右转”进入...向...行驶;标识右转动作;
- road_sign:道路标识;
- run_time:在该路段运行时间;
- grade:标识主要道路或次要道路等;
- direction:标识当前路段后,向哪个方向行驶,如向“东”行行驶;
- assist_info:标识当前是否有无辅助动作,是对action的一个补充;如右转后,到达出口再进入...向...行驶。 这里的“到达出口”即为辅助动作,如果没有辅助动作该标签内容为“无辅助动作”。又如“到达收费站”也为辅助动作;
- navigation_tag :导航标签;
使用示例
xml: curl -u "username:password" "http://api.t.sina.com.cn/location/navigation/route.xml?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey" json: curl -u "username:password" "http://api.t.sina.com.cn/location/navigation/route.json?begin_id=P010A00CHR9&end_id=P010A00CWWJ&source=appkey"