Deepzoom formatted tiles

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Deepzoom formatted tiles

smartinmedia
Hi all!

I have the following problem:
I would like to put microscopic images (e. g. 60,000 x 60,000 px) online and have chosen openlayers over seadragon as the client software because of its great possibilities to do annotations, etc.

However, I am using libvips to create static tiles (e. g. 100,000 tiles/image) in the deepzoom format, which is beautifully supported and runs extremely fast.

Unfortunately, I cannot get openlayers to recognize this format (it has 1 px image in folder 0, then increases in size until e. g. folder 6 starts with 256x256 tiles). Also, the tiles are sometimes not full 256x256, when they represent pieces of the image at the border.

I googled a lot before posting here, but could not come up with a solution. Can someone help?

Thanks

Martin
Reply | Threaded
Open this post in threaded view
|

Re: Deepzoom formatted tiles

Phil Scadden
 >Unfortunately, I cannot get openlayers to recognize this format (it
has 1 px image in folder 0, then increases in size until e. g. folder 6
starts with 256x256 tiles).

Create your layer as a TMS type. Override the getURL method and put in
one of your own (I have never heard of libvips but presumably you know
how to construct the relationship between a bounds and a tile).

Here is some code fragment that I used for a custom TMS.

function tms_getTileURL(bounds) {
     adjustBounds(bounds, this.maxExtent);
     var res = this.getServerResolution();
     var defImage = "images/none.png";
     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));
     z = this.serverResolutions != null ?
OpenLayers.Util.indexOf(this.serverResolutions, res) : z +
this.zoomOffset;*/
     var z = this.serverResolutions != null ?
     OpenLayers.Util.indexOf(this.serverResolutions, res) :
     this.getServerZoom() + this.zoomOffset;
     if (this.tileExtent.left > this.tileExtent.right) {
         var b1 = new OpenLayers.Bounds(this.tileExtent.left,
this.tileExtent.bottom, this.map.maxExtent.right, this.tileExtent.top);
         var b2 = new OpenLayers.Bounds(this.map.maxExtent.left,
this.tileExtent.bottom, this.tileExtent.right, this.tileExtent.top);
         if ((b1.intersectsBounds(bounds) ||
b2.intersectsBounds(bounds)) && z>= this.mapMinZoom ) {
             return this.url + this.serviceVersion + "/" +
this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
         } else {
             return defImage;
         }
     } else {
         if (this.tileExtent.intersectsBounds(bounds) && z >=
this.mapMinZoom ) {
             return this.url + this.serviceVersion + "/" +
this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
         } else {
             return defImage;
         }
     }
}


I opened the layer as:
             layer = new OpenLayers.Layer.TMS(name, path, {
                 type: 'png',
                 alpha: true,
                 serviceVersion: '',
                 layername: layerName,
                 tileExtent: new OpenLayers.Bounds(imageBounds.left,
imageBounds.bottom, imageBounds.right, imageBounds.top).transform(dproj,
proj),
                 mapMinZoom: imageMinZoom,
                 mapMaxZoom: imageMaxZoom,
                 getURL: tms_getTileURL,
                 displayOutsideMaxExtent: false,
                 zoomOffset: 0,
                 serverResolutions:serverRes
             });


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.

_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev