如何使用API V3加载两个或更多kml文件?
这样就可以了,
new google.maps.KmlLayer( 'http://www.example.com/kml/map.kml?&rand='+(new Date())。valueOf(),{ preserveViewport:true, 地图:地图 });
但如果我想加载两张或更多张地图,我该怎么做?
答案 0 :(得分:1)
查看google maps api documentation,你应该尝试这样的事情:
var kmllist = ["path1.kml", "path2.kml", ... ];
var kmllayers = [];
for kmlurl in kmllist:
for (var i = 0; i < kmllist.length(); i++)
{
var lay = new google.maps.kmllayer(opts);
lay.setUrl(kmllist[i]);
lay.setMap(map);
kmllayers.push(lay);
}
opts = kmlLayerOptions