[OpenLayers-Users] setOpacity does not work on google layers
joaorodr84
joaorodr84 at gmail.com
Tue Jul 14 11:54:48 PDT 2015
I am working on a GIS API that uses OpenLayers 2.13.
I also use the google layers: OpenLayers.Layer.Google.
The opacity options does not work with google layers.
I define my map and layers like this:
map = new OpenLayers.Map('map', {
allOverlays: false,
autoUpdateSize: true,
displayProjection: new OpenLayers.Projection('EPSG:4326'),
numZoomLevels: 16,
projection: new OpenLayers.Projection('EPSG:900913'),
zoomMethod: null,
units: 'km'
});
map.addControl(new OpenLayers.Control.LayerSwitcher());
var osm = new OpenLayers.Layer.OSM();
var google = new OpenLayers.Layer.Google('google', {
map: map
});
map.addLayer(google);
map.addLayer(osm);
var center = new OpenLayers.LonLat(-0.125, 51.5);
center.transform(new OpenLayers.Projection('EPSG:4326'), new
OpenLayers.Projection('EPSG:900913'));
var zoomLevel = 4;
map.setCenter(center, zoomLevel);
The setOpacity method works fine with the OSM layer:
osm.setOpacity(0.5);
But when I do:
google.setOpacity(0.5);
it does not work.
I have created a CodePen <http://codepen.io/joaorodr84/pen/PqaEww> to
easily show the problem I am facing.
Apparently, it is a common issue, because I have read about it
<http://gis.stackexchange.com/questions/69637/google-base-layer-opacity-change-in-openlayers-2-13>
, but I have not found any solutions yet.
How can I make the setOpacity method work for google layers?
Thanks a lot.
João Rodrigues
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/setOpacity-does-not-work-on-google-layers-tp5215612.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list