聚美智数


骑行批量算路

<p>[TOC]</p> <h3>接口描述</h3> <ul> <li>根据起点和终点,批量计算路线的距离和耗时,融入出行策略(不走高速、常规路线、距离较短),路线和耗时计算考虑实时路况。</li> <li>一次最多计算50条路线,起终点个数之积不能超过50, 比如2个起点25个终点,50个起点1个终点等。</li> </ul> <h3>请求地址</h3> <p><code>https://api.jumdata.com/route/matrix/riding</code></p> <h3>请求方式</h3> <ul> <li>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>&lt;div style=&quot;width:400px&quot;&gt;说明&lt;/div&gt;</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>origins</td> <td>String</td> <td>是</td> <td>起点纬度,经度。示例:40.056878,116.30815&amp;#124;40.063597,116.364973</td> </tr> <tr> <td>destinations</td> <td>String</td> <td>是</td> <td>目的地纬度,经度。示例:40.056878,116.30815&amp;#124;40.063597,116.364973。</td> </tr> <tr> <td>tactics</td> <td>String</td> <td>否</td> <td>偏好选择。该服务为满足性能需求,不含道路阻断信息干预。可选值如下:&lt;br/&gt;10 - 不走高速&lt;br/&gt;11 - 最短时间&lt;br/&gt;12 - 距离较短(默认)</td> </tr> <tr> <td>ridingType</td> <td>String</td> <td>否</td> <td>骑行类型,筛选普通自行车、电动自行车骑行,可选值:&lt;br/&gt;0 - 普通自行车 1 - 电动自行车</td> </tr> <tr> <td>roadPrefer</td> <td>String</td> <td>否</td> <td>算路方案&lt;br/&gt;0 - 默认路线&lt;br/&gt;3 - 无逆行且无阶梯的算路方案(不传默认0)</td> </tr> <tr> <td>coordType</td> <td>String</td> <td>否</td> <td>坐标类型&lt;br/&gt;可选值为:bd09ll(百度经纬度坐标)、bd09mc(百度墨卡托坐标)、gcj02(国测局加密坐标)、wgs84(gps设备获取的坐标)。</td> </tr> <tr> <td>retStraightDist</td> <td>String</td> <td>否</td> <td>0 - 返回路线距离(默认值);1 - 返回直线距离</td> </tr> </tbody> </table> <h3>签名算法说明</h3> <p><code>sign = sha256(appId + appSecret + timestamp)</code></p> <p>用服务商分配的 appId、服务商分配的 appSecret,当前时间时间戳 timestamp,按上述顺序拼接成字符串,再进行 sha256 哈希得到。如下:</p> <pre><code class="language-java">String appId = &amp;quot;xyzxy2121zxyz&amp;quot;; String timestamp = &amp;quot;1555378976238&amp;quot;; String appSecret = &amp;quot;efcefcef1121cefcefc1212121&amp;quot;; String str = appId + appSecret + timestamp; String sign = sha256(str);</code></pre> <h3>成功返回样例</h3> <pre><code class="language-json">{ &amp;quot;code&amp;quot;: 200,//返回码,详见返回码说明 &amp;quot;msg&amp;quot;: &amp;quot;成功&amp;quot;,//返回码对应描述 &amp;quot;chargeCount&amp;quot;: 4,//计费次数 &amp;quot;charge&amp;quot;: true,//计费标志 &amp;quot;taskNo&amp;quot;: &amp;quot;534713541187540749501808&amp;quot;,//本次请求号 &amp;quot;data&amp;quot;: { &amp;quot;list&amp;quot;: [//数组形式。数组中的每个元素代表一个起点和一个终点的检索结果。顺序依次为(以2起点2终点为例): //origin1-destination1,origin1-destination2,origin2-destination1,origin2-destination2 { &amp;quot;duration&amp;quot;: {//路线耗时 &amp;quot;text&amp;quot;: &amp;quot;0分钟&amp;quot;,//路线耗时的文本描述,文本描述的单位有分钟、小时两种 &amp;quot;value&amp;quot;: 0 //路线耗时的数值,数值的单位为秒。若没有计算结果,值为0 }, &amp;quot;distance&amp;quot;: {//路线距离 &amp;quot;text&amp;quot;: &amp;quot;0米&amp;quot;,//线路距离的文本描述,文本描述的单位有米、公里两种 &amp;quot;value&amp;quot;: 0 //线路距离的数值,数值的单位为米。若没有计算结果,值为0 } }, { &amp;quot;duration&amp;quot;: { &amp;quot;text&amp;quot;: &amp;quot;5分钟&amp;quot;, &amp;quot;value&amp;quot;: 293.54 }, &amp;quot;distance&amp;quot;: { &amp;quot;text&amp;quot;: &amp;quot;4.9公里&amp;quot;, &amp;quot;value&amp;quot;: 4893.29 } } ] } }</code></pre> <h3>失败返回样例</h3> <pre><code class="language-json">{ &amp;quot;msg&amp;quot;: &amp;quot;起点经纬度不能为空&amp;quot;, &amp;quot;code&amp;quot;: 400 }</code></pre> <h3>返回字段说明</h3> <table> <thead> <tr> <th>字段名</th> <th>&lt;div style=&quot;width:400px&quot;&gt;说明&lt;/div&gt;</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>返回具体结果,详见成功返回样例</td> </tr> </tbody> </table> <h3>code返回码说明</h3> <table> <thead> <tr> <th>code</th> <th>&lt;div style=&quot;width:400px&quot;&gt;说明&lt;/div&gt;</th> </tr> </thead> <tbody> <tr> <td>200</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>604</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>

页面列表

ITEM_HTML