A tiny simple plugin for Leaflet to load Zoomify tiles from the TileGroup directories. It also corrects the arbritary boundary tiles that do not always have the standard square dimensions.
- Leaflet 1.0.0-b1 (or later)
- Zoomify tile source
See the example
Extends the original Leaflet TileLayer, so basically everything that L.TileLayer
supports, is supported by this plugin.
Just include the L.TileLayer.Zoomify.js
file from the src/
dir in your page and create Zoomify tile layer with your url:
var layer = L.tileLayer.zoomify('http://thematicmapping.org/playground/zoomify/books/{g}/{z}-{x}-{y}.jpg', {
width: 5472,
height: 3648,
attribution: '© Photo: Bjørn Sandvik'
}).addTo(map);
Example Zoomify image by turban
Factory | Description |
---|---|
L.tileLayer.zoomify(urlTemplate, options? ) | Instantiates a Zoomify tile layer object given a URL template and optionally an options object. |
The urlTemplate can be a regular Leaflet url template, but also has the {g}
variable available that contains the current TileGroup number. E.g. www.your.url/{g}/{z}-{x}-{y}.jpg
.
Method | Returns | Description |
---|---|---|
getBounds() | LatLngBounds |
Returns the LatLngBounds of the Zoomify layer. |
You can use TileLayer
options and additionally the following options:
Option | Type | Default | Description |
---|---|---|---|
width | Number | undefined |
Width of the Zoomify image on the highest zoom. Can be found in ImageProperties.xml |
height | Number | undefined |
Height of the Zoomify image on the highest zoom. Can be found in ImageProperties.xml |
Option | Type | Default | Description |
---|---|---|---|
tileGroupPrefix | String | TileGroup |
The prefix used for the tile subdirectories |
tilesPerTileGroup | Number | 256 |
The number of tiles per subdirectory |
This software is released under the MIT licence. Example image is from the Hubble Site.