> I am looking for either (a) an OpenLayers layer/code/configuration that will
> automatically direct requests for tiles outside a given area to another
> tileserver or (b) a mod_tile patch or clever Apache config snippet to do the
> redirects.


Openlayers permits to overwrite the base method to access tiles in a
layer, e.g. in the properties list of the layer you pass a method to
getURL property, In this method you can implement the logic you like.

I do that for loading a paticular TMS service schema, here a snippet of code:

  var layer = new OpenLayers.Layer.TMS( "layer", "", {
    type: 'png', getURL: getTMSURL, alpha: true, numZoomLevels: 7, zoomOffset: 7
  });


function getTMSURL(bounds) {
  var res = this.map.getResolution();
  var x = Math.round((bounds.left - this.maxExtent.left) / (res *
this.tileSize.w));
  var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res *
this.tileSize.h));
  var z = this.map.getZoom() + this.options.numZoomLevels;
  if (mapBounds.intersectsBounds( bounds ) && z >= mapMinZoom && z <=
mapMaxZoom ) {
    return this.url + '/tms/' + z + "/" + x + "/" + y + "." + this.type;
  } else {
    return "/images/none.png";
  }
}

hope this helps,


Stefano

_______________________________________________
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev

Reply via email to