2013-08-06 1 views
0

저는 Google지도에서 새로 왔으며 인터넷을 통해 포럼 검색 및 조사를 한 후에이 작업을 할 수 없습니다. Google지도의 원본 코드를 기반으로 다른 색상의 2 개의 다른 비행 경로가있는 폴리 라인 맵을 그리지 않아도됩니다.Google지도 V3 2 개의 비행 경로가있는 폴리 라인

원본 코드 내가 변경하려고 해요 :

function initialize() { 
    var myLatLng = new google.maps.LatLng(0, -180); 
    var mapOptions = { 
    zoom: 3, 
    center: myLatLng, 
    mapTypeId: google.maps.MapTypeId.TERRAIN 
    }; 

    var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); 

    var flightPlanCoordinates = [ 
     new google.maps.LatLng(37.772323, -122.214897), 
     new google.maps.LatLng(21.291982, -157.821856), 
     new google.maps.LatLng(-18.142599, 178.431), 
     new google.maps.LatLng(-27.46758, 153.027892) 
    ]; 
    var flightPath = new google.maps.Polyline({ 
    path: flightPlanCoordinates, 
    strokeColor: '#FF0000', 
    strokeOpacity: 1.0, 
    strokeWeight: 2 
    }); 

    flightPath.setMap(map); 
} 

google.maps.event.addDomListener(window, 'load', initialize); 

감사를 돕는.

답변

0

당신은 다른 google.maps.Polyline()

... 
var flightPlanCoordinates = [ 
     new google.maps.LatLng(37.772323, -122.214897), 
     new google.maps.LatLng(21.291982, -157.821856), 
     new google.maps.LatLng(-18.142599, 178.431), 
     new google.maps.LatLng(-27.46758, 153.027892) 
    ]; 
    var flightPath = new google.maps.Polyline({ 
    path: flightPlanCoordinates, 
    strokeColor: '#FF0000', 
    strokeOpacity: 1.0, 
    strokeWeight: 2 
    }); 

    var flightPlanCoordinates2 = [ 
     new google.maps.LatLng(37.772323, -122.214897), 
     new google.maps.LatLng(-27.46758, 153.027892) 
     ]; 
    var flightPath2 = new google.maps.Polyline({ 
    path: flightPlanCoordinates2, 
    strokeColor: '#FF00FF', 
    strokeOpacity: 1.0, 
    strokeWeight: 2 
    }); 

    flightPath.setMap(map); 
    flightPath2.setMap(map); 

...

필요