我正在开发使用Google和Bing地图的应用程序 当我想改变地图的不透明度时,我遇到了openlayers的问题。 Bing地图正在运行但谷歌地图却没有 下面有所有带地图的代码,
map.baseLayer.setOpacity(newOpacity);
但我知道这段代码不起作用 提前谢谢你的帮助。
var googlePhysical = new OpenLayers.Layer.Google(
"Google Physical", {
type: google.maps.MapTypeId.TERRAIN,
numZoomLevels: numZoomLevels,
transparent: 'true',
alpha: true,
transitionEffect: "resize",
}
);
var googleStreets = new OpenLayers.Layer.Google(
"Google Streets", { numZoomLevels: numZoomLevels, transparent: 'true' }
);
var googleHybrid = new OpenLayers.Layer.Google(
"Google Hybrid", { type: google.maps.MapTypeId.HYBRID, numZoomLevels: numZoomLevels, sphericalMercator: true, transparent: 'true' }
);
var googleSatellite = new OpenLayers.Layer.Google(
"Google Satellite", { type: google.maps.MapTypeId.SATELLITE, numZoomLevels: numZoomLevels, transparent: 'true' }
);
var Bingroad = new OpenLayers.Layer.Bing({
name: "Bing Road", key: apiKey, type: "Road", numZoomLevels: numZoomLevels, transparent: 'true', opacity: 1
});
var Binghybrid = new OpenLayers.Layer.Bing({
name: "Bing Hybrid", key: apiKey, type: "AerialWithLabels", numZoomLevels: numZoomLevels, transparent: 'true', opacity: 1
});
var Bingaerial = new OpenLayers.Layer.Bing({
name: "Bing Aerial", key: apiKey, type: "Aerial", numZoomLevels: numZoomLevels, transparent: 'true', opacity:1
});
map.addLayers([googleSatellite,googlePhysical, googleStreets, googleHybrid]);
map.addLayers([Binghybrid, Bingaerial,Bingroad]);