[OpenLayers-Dev] pink tiles, TMS and the 180 line.

Phil Scadden p.scadden at gns.cri.nz
Mon Jun 13 17:27:32 EDT 2011


I've got two issues with TMS that might have a common resolution.

1/ The first concerns a TMS that crosses the dateline. These are a bit 
of fiend to construct but I have done it.
The problem comes with specifying an extent for the layer. This is used 
in tile.draw

draw: function() {
var maxExtent = this.layer.maxExtent;
var withinMaxExtent = (maxExtent &&
this.bounds.intersectsBounds(maxExtent, false));
// The only case where we *wouldn't* want to draw the tile is if the
// tile is outside its layer's maxExtent.
this.shouldDraw = (withinMaxExtent || this.layer.displayOutsideMaxExtent);
//clear tile's contents and mark as not drawn
this.clear();
return this.shouldDraw;
},

I cant see a way to construct an extent such that withinMaxExtent will 
be true only for tiles in the TMS when crosses the dateline. One way 
around it is to modify this routine so it detect the problem and splits the
check into two pieces.

If you dont have an extent, then the getTileURL will construct urls to 
tiles that dont exist and get pink tiles.

2/ The second concerns partial mosaic. In my case there are swath images 
which are big images, but only covering isolated spots in the overall 
image. Again, with some trouble you can construct a TMS by merging a lot 
of individual TMS (not a trivial process!)  but it is one with lots of 
missing tiles, even if efficient for diskspace.

I can see two solutions to this. One is attempt to load the url into an 
img object so a blank url path can be substituted if tile doesnt exist. 
Expensive since image is fetched twice. The second is add code to
onImageLoadError, so that, on a per layer basis, a user-specified image 
(a layer property) is substituted instead of the pink tile. Pink tile 
remains default behaviour. This solution works for both 1 and 2.

What do people think?

-- 
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232


Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.



More information about the Dev mailing list