Hello everybody,
I have coded a function that creates an image layer. In this function one of
the arguments is how transparent you want the image to be. My code looks
like this:
function createImageOverlay(imageURL, bounds, width, height,
transparencyFactor)
{
var newImageLayer = new OpenLayers.Layer.Image(
//Layer name
"My Image",
//Layer Url
imageURL,
//Image span coordinates
//bounds[0] == bottom left
//bounds[1] == top right
new
OpenLayers.Bounds(bounds[0].lon,bounds[0].lat,bounds[1].lon,bounds[1].lat),
//pixel size of image
//"size of the image as it
should display when fully zoomed out"
new OpenLayers.Size(width,
height),
{
projection: "EPSG:900913",
isBaseLayer: false,
visibility: true
}
)
if ((transparencyFactor<=
1.0)&&(transparencyFactor>=0.0))
newImageLayer.setOpacity(transparencyFactor);
else newImageLayer.setOpacity(1.0);
return newImageLayer;
}
However the image layer doesn't display right away, instead i first have to
zoom in a level before I can see it, after it's been added to the map.
Furthermore, while the transparency seems to works for a few zoom levels,
after that the image stops being transparent, and it stays this way even if
I zoom out again. Does anybody know where the problem might be?
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users