2013-04-26 2 views
0

Google지도에서 도움이 필요 V3 V3 경로에 여러 지점을 표시하고 싶습니다. 현재 출발지와 목적지를 언급했지만 웨이 포인트 (arrWaypoints) 배열에있는 모든 포인트를 어떻게 표시 할 수 있습니까? 다음은 제 코드입니다.경로에 다중 경로 지점 표시

var origin = arrWaypoints[0]; 
var destination = arrWaypoints[1]; 
this.directions.route({ 
        origin: origin, 
        destination: destination, 
        travelMode: google.maps.DirectionsTravelMode.DRIVING, 
        unitSystem: google.maps.DirectionsUnitSystem.METRIC 
       }, function(result, status) { 
    ........ 

감사합니다, 샤 라트 당신의 예에서

답변

0

, 표시 할 중간 지점이 없습니다. 포함 할 추가 웨이 포인트가있는 경우 요청은 다음과 같이 표시됩니다.

var origin = arrWaypoints[0]; 
var destination = arrWaypoints[arrWaypoints.length-1]; 
// Origin and destination don't need to be in the arrWaypoints anymore as they're listed separately in the request. 
arrWaypoints.splice(arrWaypoints.length-1, 1); 
arrWaypoints.splice(0, 1); 
this.directions.route({ 
       origin: origin, 
       destination: destination, 
       waypoints: arrWaypoints, 
       travelMode: google.maps.DirectionsTravelMode.DRIVING, 
       unitSystem: google.maps.DirectionsUnitSystem.METRIC 
      }, function(result, status) { 
    ........ 
+0

감사의 말 Eric, 귀하의 의견은 제가이 문제를 해결하는 데 도움이되었습니다 ... – Sharath