[OpenLayers-Dev] Usage of OpenLayers.Layer.Image: problem with IE in small resolutions

Tim Schaub tschaub at opengeo.org
Tue Jul 6 16:27:46 EDT 2010


On 7/5/10 7:08 AM, Cédric MOULLET wrote:
> Hi,
> I try to use OpenLayers.Layer.Image in order to create an opacity layer
> (in order to hide partially the orthophoto, in this case). The layer is
> defined with:
>
> var voidLayer = new OpenLayers.Layer.Image("voidLayer",
> 'gfx/ol/white.png',
>                  new OpenLayers.Bounds.fromArray(this.baseConfig.maxExtent),
>                  new OpenLayers.Size(1, 1), {
>              displayInLayerSwitcher: false,
>              visibility: false,
>              transitionEffect: 'resize',
>              resolutions: this.baseConfig.pixelmapResolutions
>          });
>
> - white.png is a white 1x1 px image
>
> This works very well in FF and IE for scale higher than 1:100'000:
> http://mf-geoadmin0i.bgdi.admin.ch/?zoom=4&X=152100&Y=565025&bgOpacity=80&bgLayer=voidLayer
> <http://mf-geoadmin0i.bgdi.admin.ch/?zoom=4&X=152100&Y=565025&bgOpacity=80&bgLayer=voidLayer>
>
> But, for smaller scale, it doesn't work for IE (but still work for FF):
> http://mf-geoadmin0i.bgdi.admin.ch/?zoom=5&X=152100&Y=565025&bgOpacity=80&bgLayer=voidLayer
> <http://mf-geoadmin0i.bgdi.admin.ch/?zoom=5&X=152100&Y=565025&bgOpacity=80&bgLayer=voidLayer>
>
> After investigation, it seems that the image size is huge: "overflow:
> hidden; position: absolute; z-index: 1; left: -6562px; top: -9689px;
> width: 24000px; height: 16000px;" This is normal, but it seems that IE
> doesn't like that. Is this limitation already known ? Do you see any
> workaround (or other ways to create an opacity layer) ?
>

We did notice this limitation sometime shortly after adding the Image 
layer.  A quick workaround is to use a white.png that is bigger than 1x1.

If you want to wander from the API, you could set the following:

     layer.tile.imgDiv.style.backgroundColor = "white"

Tim

> Thanks,
> Cédric
>
>
>
> --
> Welcome to my world: http://www.cedricmoullet.com/
> My Linked In profile: http://www.linkedin.com/in/cedricmoullet
> Twitter: http://twitter.com/cedricmoullet
>
>
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Dev mailing list