[OpenLayers-Trac] [OpenLayers] #3513: empty url for OpenLayers.Tile.Image causes bad tile request

OpenLayers trac-20090302 at openlayers.org
Wed Sep 21 10:16:47 EDT 2011


#3513: empty url for OpenLayers.Tile.Image causes bad tile request
-------------------------+--------------------------------------------------
 Reporter:  rayd         |       Owner:  ahocevar    
     Type:  bug          |      Status:  new         
 Priority:  minor        |   Milestone:  2.12 Release
Component:  Tile.Image   |     Version:  2.10        
 Keywords:  tiles, pink  |       State:              
-------------------------+--------------------------------------------------
 When a Tile.Image object is assigned an empty string for the src field, it
 sets that empty url as the src attribute of the associated img div,
 causing the browser to attempt to load an image from that empty url. The
 positionImage() function uses the src value without checking it:
 {{{
 ...
 else {
       OpenLayers.Util.modifyDOMElement(this.imgDiv,
              null, null, imageSize) ;
       this.imgDiv.src = this.url;
 }
 }}}
 I would think that when url === "", we should remove the img element or at
 least not set the src attribute on the img element, so that it does not
 attempt to load that resource.

 I noticed this when using a WMTS layer with restricted bounds. I was using
 Chrome. This problem can be reproduced by:

  * Creating a WMTS layer with a maxExtent != entire map bounds.
  * Turning on the layer and zooming out so that areas outside of the
 bounds of the layer are visible.
  * You should see pink error tiles in the areas outside the layer's
 bounds.
  * Setting a breakpoint within the Tile.Image.renderTile() function after
 the call to this.layer.getURL() will show an empty url for some tiles,
 which is then propagated to the img element.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3513>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list