在谷歌地图上添加多个自定义图层需要帮助。我有脚本:
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;
}
与一层“WWII”一起工作很棒!需要添加第二个自定义层“WWII - 2”,也许有人可以帮忙?