example: custom tile sources

A Custom Tile Source can be create via inline configuration by specifying a single function named 'getTileUrl', along with the required values for 'height', 'width'. Optional values include 'tileSize', 'tileOverlap', 'minLevel', and 'maxLevel'. Additionally, any default functions implemented by OpenSeadragon.TileSource can be overridden. Functionally this allows you to define a new TileSource implementation inline.

Alternatively, you can always create a new tile source which implements the required interfaces 'getTileUrl', 'configure', and 'supports'.

Please note the examples on this page are sketches or outlines and not functional examples because we do not have an available service to provide a working example against. If you have a service you can provide an example to illustrate against please let us know.

Inline Configuration for Custom Tile Sources

Minimally, an inline configuration for a custom tile source only needs to implement the 'getTileUrl' interface and provide a height and width for the maximum resolution of the image.

Example Inline Configuration for Custom Tile Sources

Below is a make believe minimal inline configuration. Note that the default tileSize is available as a property of the tile source.

    OpenSeadragon({
        id:            "example-inline-configuration",
        prefixUrl:     "/openseadragon",
        showNavigator:  true,
        tileSources:   {
            height: 1140,
            width:  2450,
            getTileUrl: function( level, x, y ){
                return "http://example.org/imageservice/"+level+"/"+x+"/"+y+"/?tileSize="+this.tileSize
            }
        }
    });