[OpenLayers-Users] multi servers for Tile services

Alper Dinçer alperd.liste at gmail.com
Mon Nov 17 05:59:16 EST 2008


Hi,

I have been working on distributed tile services, and I have 2-4 tile
services for each tile layers.

I found the sample on
http://www.openlayers.org/dev/examples/multiserver.html address, but it
works on WMS services. I tried to do same thing for TMS,
but I haven't archived any success until now.

What will you suggest for this problem?

Thanks.

Alper.


*Sample code is below :*
---------------------------------------------------------------

var url_fbmaden = ["http://dsi-ortak1/",
                           "http://dsi-ortak2/"];

bm_fbmaden = new OpenLayers.Layer.TMS(
    "FB Layer",
    url_fbmaden,
    {
        'isBaseLayer' : false,
        type: 'png',
        visibility : false,
        numZoomLevels: 22,
        getURL: getTileFromGAE
    }
);

function getTileFromGAE(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;
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081117/e97dddb9/attachment.html


More information about the Users mailing list