自行车骑行路线规划
<h3>接口描述</h3>
<ul>
<li>可根据起终点坐标检索符合条件的骑行路线规划方案。</li>
</ul>
<h3>请求地址</h3>
<p><code>https://api.jumdata.com/route/ride</code></p>
<h3>请求方式</h3>
<ul>
<li>GET/POST</li>
</ul>
<h3>请求格式</h3>
<ul>
<li>x-www-form-urlencoded</li>
</ul>
<h3>请求参数</h3>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必填</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>appid</td>
<td>String</td>
<td>是</td>
<td>服务商分配的唯一标识</td>
</tr>
<tr>
<td>timestamp</td>
<td>Long</td>
<td>是</td>
<td>当前时间的毫秒数</td>
</tr>
<tr>
<td>sign</td>
<td>String</td>
<td>是</td>
<td>签名,详见签名算法说明</td>
</tr>
<tr>
<td>origin</td>
<td>String</td>
<td>是</td>
<td>起点经纬度 经度在前,纬度在后,经度和纬度用","分割,经纬度小数点后不得超过6位</td>
</tr>
<tr>
<td>destination</td>
<td>String</td>
<td>是</td>
<td>目的地经纬度 经度在前,纬度在后,经度和纬度用","分割,经纬度小数点后不得超过6位</td>
</tr>
<tr>
<td>alternativeRoute</td>
<td>String</td>
<td>否</td>
<td>返回路线条数 <br/>1:多备选路线中第一条路线<br/>2:多备选路线中前两条路线<br/>3:多备选路线中三条路线<br/>不传则默认返回一条路线方案</td>
</tr>
<tr>
<td>showFields</td>
<td>String</td>
<td>否</td>
<td>返回结果控制,用来筛选接口返回结果中是否出现哪些字段。</br>show_fields的使用需要遵循如下规则:</br>1、具体可指定返回的字段类型有:</br>cost</br>navi</br>polyline</br>任选一个或多个作为入参值,即可在返回结果中显示。</br>2、多个值间采用“,”进行分割;</br>3、show_fields未设置、为空时,只返回基础信息类内字段;</br></td>
</tr>
</tbody>
</table>
<h3>签名算法</h3>
<pre><code>sign = sha256( appId + appSecret + timestamp)</code></pre>
<p>用服务商分配的 appId、服务商分配的 appSecret,当前时间毫秒数 timestamp,按上述顺序拼接成字符串,再进行 sha256 哈希得到。如下:</p>
<pre><code class="language-java">String appId = &quot;xyzxy2121zxyz&quot;;
String timestamp = &quot;1555378976238&quot;;
String appSecret = &quot;efcefcef1121cefcefc1212121&quot;;
String str = appId + appSecret + timestamp;
String sign = sha256(str);</code></pre>
<h3>正确返回样例</h3>
<pre><code>{
&quot;code&quot;: 200,// 返回码,详见返回码说明
&quot;msg&quot;: &quot;成功&quot;,// 返回码对应描述
&quot;taskNo&quot;: &quot;657592213165464010084862&quot;,// 本次请求号
&quot;charge&quot;: true,// 计费标志
&quot;data&quot;: {
&quot;strategyNum&quot;: &quot;1&quot;,//路径规划方案总数
&quot;strategyList&quot;: {//返回的规划方案列表
&quot;paths&quot;: [ //算路方案详情
{
&quot;duration&quot;: &quot;2699&quot;,//线路耗时,包括方案总耗时及分段step中的耗时
&quot;distance&quot;: &quot;8944&quot;,//方案距离,单位:米
&quot;steps&quot;: [
{
&quot;road_name&quot;: &quot;&quot;,//分段道路名称
&quot;orientation&quot;: &quot;西&quot;,//进入道路方向
&quot;step_distance&quot;: 81,//分段距离信息
&quot;instruction&quot;: &quot;向西骑行81米左转&quot;,//骑行指示
//以下字段是否返回,需要根据 showFields 字段传入的值来控制
&quot;cost&quot;: {//设置后可返回方案所需时间及费用成本
&quot;duration&quot;: &quot;24&quot;//线路耗时,包括方案总耗时及分段step中的耗时
},
&quot;navi&quot;: {//设置后可返回详细导航动作指令
&quot;assistant_action&quot;: &quot;&quot;,//导航辅助动作指令
&quot;action&quot;: &quot;左转&quot;,//导航主要动作指令
&quot;walk_type&quot;: &quot;0&quot;//算路结果中存在的道路类型:0:普通道路;1:人行横道;3:地下通道;4:过街天桥;5:地铁通道;6:公园;7:广场;8:扶梯;9:直梯;10:索道;11:空中通道;12:建筑物穿越通道;13:行人通道;14:游船路线;15:观光车路线;16:滑道;18:扩路;19:道路附属连接线;20:阶梯;21:斜坡;22:桥;23:隧道;30:轮渡;
},
&quot;polyline&quot;: &quot;120.109054,30.277231;120.108212,30.277188&quot;//设置后可返回分路段坐标点串,两点间用“,”分隔
}
]
}
],
&quot;origin&quot;: &quot;120.10910,30.27714&quot;,//起点经纬度
&quot;destination&quot;: &quot;120.17931,30.25326&quot;//终点经纬度
}
}
}
</code></pre>
<h3>错误返回样例</h3>
<pre><code>{
&quot;msg&quot;: &quot;起点经纬度不能为空&quot;,
&quot;code&quot;: 400
}</code></pre>
<h3>返回字段说明</h3>
<table>
<thead>
<tr>
<th>字段名</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>返回码,详见返回码说明</td>
</tr>
<tr>
<td>msg</td>
<td>code对应的描述</td>
</tr>
<tr>
<td>charge</td>
<td>是否计费</td>
</tr>
<tr>
<td>taskNo</td>
<td>本次请求号</td>
</tr>
<tr>
<td>data</td>
<td>返回具体结果,object类型,详见data返回字段说明</td>
</tr>
</tbody>
</table>
<h4>code 返回码说明</h4>
<table>
<thead>
<tr>
<th>code</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>200</td>
<td>成功(计费)</td>
</tr>
<tr>
<td>201</td>
<td>查询坐标或规划点(包括起点、终点、途经点)在海外,但没有海外地图权限</td>
</tr>
<tr>
<td>202</td>
<td>查询信息存在非法内容</td>
</tr>
<tr>
<td>203</td>
<td>规划点(包括起点、终点、途经点)不在中国陆地范围内</td>
</tr>
<tr>
<td>204</td>
<td>划点(起点、终点、途经点)附近搜不到路</td>
</tr>
<tr>
<td>205</td>
<td>路线计算失败,通常是由于道路连通关系导致</td>
</tr>
<tr>
<td>206</td>
<td>起点终点距离过长</td>
</tr>
<tr>
<td>400</td>
<td>参数错误</td>
</tr>
<tr>
<td>404</td>
<td>接口地址不正确</td>
</tr>
<tr>
<td>500</td>
<td>系统维护,请稍候再试</td>
</tr>
<tr>
<td>601</td>
<td>接口未开通</td>
</tr>
<tr>
<td>602</td>
<td>账号停用</td>
</tr>
<tr>
<td>603</td>
<td>余额不足请充值</td>
</tr>
<tr>
<td>606</td>
<td>调用超限,请稍候再试</td>
</tr>
<tr>
<td>607</td>
<td>ip不在白名单</td>
</tr>
<tr>
<td>609</td>
<td>请求过于频繁,请稍候再试</td>
</tr>
<tr>
<td>610</td>
<td>请求超时</td>
</tr>
<tr>
<td>999</td>
<td>其他,以实际返回为准</td>
</tr>
</tbody>
</table>