Google maps api 3 Google Maps V3多段线具有2条飞行路径

Google maps api 3 Google Maps V3多段线具有2条飞行路径,google-maps-api-3,polyline,flightpath,Google Maps Api 3,Polyline,Flightpath,我是谷歌地图的新手,在互联网上的论坛上搜索和研究之后,我无法得到这项工作。基于谷歌地图的原始代码,我想画一个多段线地图,上面有两条不同的飞行路径,颜色也不同 我试图更改的原始代码: function initialize() { var myLatLng = new google.maps.LatLng(0, -180); var mapOptions = { zoom: 3, center: myLatLng, mapTypeId: google.maps.Ma

我是谷歌地图的新手,在互联网上的论坛上搜索和研究之后,我无法得到这项工作。基于谷歌地图的原始代码,我想画一个多段线地图,上面有两条不同的飞行路径,颜色也不同

我试图更改的原始代码:

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);

谢谢您的帮助。

您需要另一个
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);