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

ray.diciaccio ray.diciaccio at ll.mit.edu
Tue Sep 20 16:49:24 EDT 2011


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 {
              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?

- Ray

View this message in context: http://osgeo-org.1803224.n2.nabble.com/empty-url-for-OpenLayers-Tile-Image-objects-tp6813745p6813745.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

More information about the Dev mailing list