在openlayer中,Bing的不透明度发生了变化,但谷歌却没有

时间:2014-02-21 13:46:34

标签: c# asp.net google-maps maps openlayers

我正在开发使用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]);

0 个答案:

没有答案