2014-04-04 23 views
0

我需要一些幫助在谷歌地圖使用方向服務,我正在通過ajax請求座標(lat,long)..我發現如果我只有7個座標方向服務工作它將繪製標記和線路地圖,。現在如果我想有40個座標的要求,也不會畫有或全無happens.my座標返回這樣方向服務googlemap

[「12.34343,14.324324」,「12.34343, 14.324324" , 「12.34343,14.324324」, 「12.34343,14.324324」, 「12.34343,14.324324」]

//我只是把這裏舉例爲座標,直到它達到40個座標......這是我在ajax中完成的。

$.ajax({ 
    ... 
    ... 
     ... 
    success: function (data){ 
    var pts=[]; 
     for(var x=0;x<data.datapts.length;x++){ 
      waypts.push({ 
       location:data.datapts[x], 
       stopover:true 
      }); 
     } 
     directionsService.route(request, function(response, status) { 
      if (status == google.maps.DirectionsStatus.OK) { 
       directionsDisplay.setDirections(response);   
      } 
     } 
    }); 
+1

[Google Map API路由請求限制]的可能重複(http://stackoverflow.com/questions/18946208/google-map-api-route-request-limit/18946268#18946268)。費用API中有[最多8個路標](https://developers.google.com/maps/documentation/javascript/directions#Waypoints)。 – geocodezip

回答