I understand how to set opactity to a map layer in OSM but how do you get the opacity?

Perhaps something like


OpenLayers.Util.getElement('opacity').value = layer.???

I have tried different combinations without success.

1 Answer 1


In OpenLayers 2, opacity is a property, no need to use a function to get it :

  OpenLayers.Util.getElement('opacity').value = layer.opacity;

cf http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.