Tag: tile

Styling missing tiles in OpenLayers.

Posted by – Tuesday 2012-09-18

In an OpenLayers based web map when a tile fails to load, an a pink colored and ugly one will be displayed instead.

Fortunately, this behaviour can be changed. For instance, the background color can be set from pink to transparent.

OpenLayers.Util.onImageLoadErrorColor = 'transparent';

Another possible solution is using a custom graphic for the tile.

OpenLayers.Util.onImageLoadError = function() {
     this.src = '/path/to/custom-blank.png';
};

However, as of version 2.12 of OpenLayers it seems that none of these solutions work.

More…