Google maps 谷歌地图获取多段线数组

Google maps 谷歌地图获取多段线数组,google-maps,google-maps-api-3,Google Maps,Google Maps Api 3,我需要在谷歌地图上画多条路线。通过谷歌搜索,我找到了两种解决方案。1是在SeParate DirectionsRenderer对象中创建和渲染每条管线。另一个解决方案(我已经找到)建议将多边形存储在一个数组中,然后一次将它们全部绘制出来(这对我来说似乎是一个更好的解决方案) 问题是,我无法找到一种方法来获取地图上的所有多边形。有没有人有一段关于如何做到这一点的代码 我正在使用第一种解决方案。这是我的密码 var map; var polyGidis; var polyDonus; var poz

我需要在谷歌地图上画多条路线。通过谷歌搜索,我找到了两种解决方案。1是在SeParate DirectionsRenderer对象中创建和渲染每条管线。另一个解决方案(我已经找到)建议将多边形存储在一个数组中,然后一次将它们全部绘制出来(这对我来说似乎是一个更好的解决方案)


问题是,我无法找到一种方法来获取地图上的所有多边形。有没有人有一段关于如何做到这一点的代码

我正在使用第一种解决方案。这是我的密码

var map;
var polyGidis;
var polyDonus;
var pozsGidis = [];
var pozsDonus = [];
function init() {
   var myOptions = {
      zoom: 5,
      center: new google.maps.LatLng(39.00, 35.00),
      mapTypeId: google.maps.MapTypeId.ROADMAP
   };
   map = new google.maps.Map(document.getElementById('divMap'), myOptions);
   polyGidis = new google.maps.Polyline({ strokeColor: 'black', strokeOpacity: 0.8, strokeWeight: 2, map: map, zIndex: 100 });
   polyDonus = new google.maps.Polyline({ strokeColor: 'red', strokeOpacity: 0.8, strokeWeight: 6, map: map, zIndex: 80 });

   var polyPathGidis = polyGidis.getPath();
   var polyPathDonus = polyDonus.getPath();

   for (var i = 0; i < pozsGidis.length; i++) {
      polyPathGidis.push(new google.maps.LatLng(pozsGidis[i].lat, pozsGidis[i].lng));
   }
   for (var i = 0; i < pozsDonus.length; i++) {
      polyPathDonus.push(new google.maps.LatLng(pozsDonus[i].lat, pozsDonus[i].lng));
   }
}
var映射;
多角形变种;
多齿变种;
var pozsGidis=[];
var pozsDonus=[];
函数init(){
变量myOptions={
缩放:5,
中心:新google.maps.LatLng(39.00,35.00),
mapTypeId:google.maps.mapTypeId.ROADMAP
};
map=new google.maps.map(document.getElementById('divMap'),myOptions);
polyGidis=new google.maps.Polyline({strokeColor:'black',strokepacity:0.8,strokewweight:2,map:map,zIndex:100});
polyDonus=new google.maps.Polyline({strokeColor:'red',strokeOpacity:0.8,strokeWeight:6,map:map,zIndex:80});
var polyPathGidis=polyGidis.getPath();
var polyPathDonus=polyDonus.getPath();
对于(var i=0;i
我正在使用第一种解决方案。这是我的密码

var map;
var polyGidis;
var polyDonus;
var pozsGidis = [];
var pozsDonus = [];
function init() {
   var myOptions = {
      zoom: 5,
      center: new google.maps.LatLng(39.00, 35.00),
      mapTypeId: google.maps.MapTypeId.ROADMAP
   };
   map = new google.maps.Map(document.getElementById('divMap'), myOptions);
   polyGidis = new google.maps.Polyline({ strokeColor: 'black', strokeOpacity: 0.8, strokeWeight: 2, map: map, zIndex: 100 });
   polyDonus = new google.maps.Polyline({ strokeColor: 'red', strokeOpacity: 0.8, strokeWeight: 6, map: map, zIndex: 80 });

   var polyPathGidis = polyGidis.getPath();
   var polyPathDonus = polyDonus.getPath();

   for (var i = 0; i < pozsGidis.length; i++) {
      polyPathGidis.push(new google.maps.LatLng(pozsGidis[i].lat, pozsGidis[i].lng));
   }
   for (var i = 0; i < pozsDonus.length; i++) {
      polyPathDonus.push(new google.maps.LatLng(pozsDonus[i].lat, pozsDonus[i].lng));
   }
}
var映射;
多角形变种;
多齿变种;
var pozsGidis=[];
var pozsDonus=[];
函数init(){
变量myOptions={
缩放:5,
中心:新google.maps.LatLng(39.00,35.00),
mapTypeId:google.maps.mapTypeId.ROADMAP
};
map=new google.maps.map(document.getElementById('divMap'),myOptions);
polyGidis=new google.maps.Polyline({strokeColor:'black',strokepacity:0.8,strokewweight:2,map:map,zIndex:100});
polyDonus=new google.maps.Polyline({strokeColor:'red',strokeOpacity:0.8,strokeWeight:6,map:map,zIndex:80});
var polyPathGidis=polyGidis.getPath();
var polyPathDonus=polyDonus.getPath();
对于(var i=0;i