[OpenLayers-Dev] empty url for OpenLayers.Tile.Image objects

Eric Lemoine eric.lemoine at camptocamp.com
Wed Sep 21 06:01:35 EDT 2011

On Tue, Sep 20, 2011 at 10:49 PM, ray.diciaccio
<ray.diciaccio at ll.mit.edu> wrote:
> Hi,
> I've noticed some strange behavior with the OpenLayers.Tile.Image object
> when the its url property is set to an empty string. I noticed an example of
> this when using a WMTS layer with a restricted extent. In the
> OpenLayers.Layer.WMTS.getURL() function, if the tile bounds are outside of
> the tileFullExtent property of the layer, then url is returned as an empty
> string. Then OpenLayers.Tile.Image.positionImage() is called and it sets the
> src property of the image div to the url string without checking the
> validity of the value:
> ...
> else {
>       OpenLayers.Util.modifyDOMElement(this.imgDiv,
>              null, null, imageSize) ;
>       this.imgDiv.src = this.url;
> }
> So the image tile (with src = "") tries to load whatever is located at the
> root of my application -- which happens to be some html page. I would think
> that we just shouldn't place a request when the url is empty -- that way we
> limit attempted loading of spurious tiles. (This also causes some display
> problems -- at least in Chrome -- with pink error tiles appearing in the
> areas outside the extent of my data layer). Can we just remove the img divs
> whenever this is the case? Or is there a better solution to this?

This sounds like a bug in the library. Feel free to create a ticket
for that. Thanks,

Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com

More information about the Dev mailing list