Google マップに複数のカスタム レイヤーを追加するためのヘルプが必要です。私はスクリプトを持っています:
function newMap(id,lon,lat,zoom,mapstart){
var nmap = new GMap2(document.getElementById(id),{backgroundColor: "Silver"});
nmap.addControl(new GLargeMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(8,37)));
nmap.addControl(new GOverviewMapControl());
nmap.addControl(new GScaleControl());
nmap.enableScrollWheelZoom();
nmap.enableContinuousZoom();
var GMapTypeOptions = new Object({minResolution: 9, maxResolution: 18});
var copyCollection = new GCopyrightCollection('');
var copyright = new GCopyright(1, new GLatLngBounds(new GLatLng(-89,-179), new GLatLng(89,179)),0,"<font color=white><B>Demo <a href=http://mysite.com target=_blank><font color=white>mysite.com</font></a><BR>demo <a href=http://www.maps.com target=_blank><font color=white>maps.com</font></a>, <a href=http://www.pobeda-info.by target=_blank><font color=white>pobeda-info.by</font></a></B><BR></font>");
copyCollection.addCopyright(copyright);
var WWIILayer = new GTileLayer(copyCollection, 9,18,{tileUrlTemplate:'http://mymap.com/AerialWWII/Z{Z}/{Y}/{X}.jpg'});
//http://46.182.27.171
var WWIIMap = new GMapType([WWIILayer], new GMercatorProjection(22), "WWII", {});
nmap.addMapType(WWIIMap);
var WWIIHybMap = new GMapType([WWIILayer, G_HYBRID_MAP.getTileLayers()[1]], new GMercatorProjection(22), "Show streets",GMapTypeOptions);
nmap.addMapType(WWIIHybMap);
var hierarchy = new GHierarchicalMapTypeControl();
hierarchy.addRelationship(WWIIMap, WWIIHybMap, false);
if (mapstart==1) {
nmap.setCenter( new GLatLng(lon,lat), zoom, WWIIMap);
} else {
nmap.setCenter( new GLatLng(lon,lat), zoom, G_SATELLITE_MAP);
}
nmap.addControl(hierarchy);
return nmap;
}
1つのレイヤー「WWII」で大活躍!2 番目のカスタム レイヤー「WWII - 2」を追加する必要があります。