[OSM-talk] Informationfreeway defaults to sea if tile unloadable, e.g. due to proxy being unreachable

Tom Hughes tom at compton.nu
Fri Aug 17 10:30:21 BST 2007


In message <8fcd02310708170216o4957d339xe943fba850c759c6 at mail.gmail.com>
        80n80n at gmail.com wrote:

> I don't know why, but OpenLayers tries to request tiles with addresses like
> y=-1 if you pan outside the normal boundaries of the planet.  If we could
> fix that then it would be possible to serve up a proper 404 tile when there
> really is a 404.

Because that is what your get URL function is returning - we hacked
the one on the main slippy map to avoid doing so. It only happens when
you have OpenLayer's normal bounds limitation turned off to allow
wrapping at low zooms.

The main slippy map now uses this:

function getTileURL(bounds) {
   var res = this.map.getResolution();
   var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
   var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
   var z = this.map.getZoom();
   var limit = Math.pow(2, z);

   if (y < 0 || y >= limit)
   {
     return OpenLayers.Util.getImagesLocation() + "404.png";
   }
   else
   {
     x = ((x % limit) + limit) % limit;

     return this.url + z + "/" + x + "/" + y + "." + this.type;
   }
}

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/




More information about the talk mailing list