Location/route/en

跳转到: 导航, 搜索

目录

Location/route

Query API for driving route.

URL

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

Format

xml

HTTP Request Method

GET

Requires Authentication

false

Requests Count Limitation

true

Request Parameters

optional parameters:

  • city1(city2):city code of starting point. Default is 0010 (Beijing)
o Usage: http://api.map.sina.com.cn/i/route.php?city1=0010&city2=0021
  • t: query type. 0:speed-first. 1:cost-first. 2:distance-first
o Usage: http://api.map.sina.com.cn/i/route.php?city1=0010&city2=0021&begin_id=46727&end_id=5000&t=1

At least one of following parameters is required:

  • begin_id: starting point ID (use it with city1. this parameter overwrites beginxy).
o Usage: http://api.map.sina.com.cn/i/route.php?city1=0010&city2=0021&begin_id=46727&end_id=5000
  • beginxy: coordinate of starting point (separated by comma)
o uasge: http://api.map.sina.com.cn/i/route.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 city1, and this parameter overwrites beginxy).
o Usage: http://api.map.sina.com.cn/i/route.php?city1=0010&city2=0021&begin_id=46727&end_id=5000
  • endxy: corrdinate of end point (separated by comma)
o Usage: http://api.map.sina.com.cn/i/route.php?beginxy=116.35442,39.88904&endxy=116.34171,39.58904

Response

XML Example:(\P tag is P tag in practice) Tags explanation: XML:root node; List node:this node contains multiple item nodes; item node:

  <seg_id>1</seg_id>
  <seg_Length>24</seg_Length>
  <roadSign>行驶时间;等级方向;坐标点;道路名称;</roadSign>
  <sTime>1</sTime>
  <sGrade>主要道路</sGrade>
  <sDirection>东</sDirection>
  <roadName>北四环西路辅路</roadName>
  <segline>11630921,3998503;11630933,3998504;11630951,3998505</segline>
  <action>右转</action>
  <accessInfo/>
  <navSign/>
  <\P>11630921,3998503</\P>
  <next>11630951,3998505</next>


  • Seg_id: road ID. Identify the road.
  • Seg_Length: Road length;
  • roadSign: Road sign;
  • sTime: Driving time on the road;
  • sGrade: Main road or side road;
  • sDirection: Direction, eg east;
  • roadName: Road name;
  • segline: Coordinate information about current road;
  • action: Current action, eg turn right;
  • P : First Corrdinate of this road;
  • Next: Last Corrdinate of this road;
  • statusInfo: Status information.
  • midsxy: Coordinate on the way;
  • total: Total count of this driving rount;
  • segNum: Segment count;
  • distance: Driving distance;
  • time: Driving time;
  • pathstr: Coordinates of the path;
  • startxy: Corrdinate of starting point;
  • endxy: Corrdinate of end point;
  • result: result. 0 means no drive rount found;
  • type: Reponse type. 0:speed-first. 1:cost-first. 2:distance-first
<?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>

Usage

user your own appkey

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