[OpenLayers-Users] KaMap pink tiles
Stuart Eve
stuarteve at lparchaeology.com
Wed Dec 13 14:24:19 EST 2006
Hi all
I was having some problems with my KaMap layer producing pink tiles on
occasion - after advice from Christopher and TSchaub on the irc - I came
up with a bit of a hack that seemed to fix the problem. I haven;t really
done anything with JS before so its probably pretty ugly and perhaps
someone may want to clean it up. It basically sets the src of the image
again - if it really is a broken image after two goes it gives up and
makes it pink (although I haven't had that happen). It starts from Line
244 of Util.js
OpenLayers.Util.onImageLoadError = function() {
this.setAttribute('tries',1);
do{
this.setAttribute('src',this.getAttribute('src'));
this.setAttribute('tries',this.getAttribute('tries') + 1);
}while(this.getAttribute('tries') < 2);
if (this.getAttribute('tries') >= 2){
this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
this.style.display = "";
}
};
Hope it helps someone
Stuart
More information about the Users
mailing list