O'Reilly logo

OpenLayers Cookbook by Antonio Santiago Perez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changing the layer opacity

When you are working with many layers—both raster and vector layers—you will probably find situations where a layer that is on top of another layer hides the one below it. This is more common when working with raster WMS layers without the transparent property set to true or tiled layers such as, OpenStreetMaps, Google, and Bing. The layer opacity is set to 50% in the following screenshot:

Changing the layer opacity

The OpenLayers.Layer base class has an opacity property, implemented by concrete subclasses, that allows us to modify the opacity of the layers. It is a float value that can range from 0.0 (completely transparent) to 1.0 (completely ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required