Route Matrix API v2.0Web服務(wù)API
Route Matrix API v2.0 Beta是一套以HTTP/HTTPS形式提供的批量算路接口,返回路線規(guī)劃距離和行駛時(shí)間。
功能介紹
1.批量計(jì)算路線的距離和耗時(shí);
2.支持駕車、騎行和步行三種形式;
3.步行時(shí)任意起終點(diǎn)之間的距離不得超過200KM,超過此限制會返回參數(shù)錯(cuò)誤;
4.一次最多計(jì)算50條路線,起終點(diǎn)個(gè)數(shù)之積不能超過50。 比如2個(gè)起點(diǎn)25個(gè)終點(diǎn),50個(gè)起點(diǎn)1個(gè)終點(diǎn)等;但在實(shí)際操作過程中,每次請求數(shù)額區(qū)間為(2,1024);
使用方法
1.申請密鑰(ak) ,作為訪問服務(wù)的依據(jù);(根據(jù)不同類型請求申請不同ak)
2.請求URL:
? 駕車 ? http://api.map.baidu.com/routematrix/v2/driving?
? ?騎行 ? http://api.map.baidu.com/routematrix/v2/riding?
? ?步行 ? ?http://api.map.baidu.com/routematrix/v2/walking?
3.基礎(chǔ)參數(shù)

4.返回結(jié)果:
{
"status": 0,
"result": [
{
"distance": {
"text": "19.7公里",
"value": 19746
},
"duration": {
"text": "30分鐘",
"value": 1803}},
{"distance": {
"text": "21.3公里",
"value": 21250
},
"duration": {
"text": "33分鐘",
"value": 1956}},
{"distance": {
"text": "45.8公里",
"value": 45773
},"duration": {
"text": "1.2小時(shí)",
"value": 4434}},
{"distance": {
"text": "47.3公里",
"value": 47277
},"duration": {
"text": "1.3小時(shí)",
"value": 4587}}],
"message": "成功"
}