Example of a Zoomify source.
Zoomify is a format for deep-zooming into high resolution images. This example shows how to use the Zoomify source with a pixel projection.
<!DOCTYPE html> <html> <head> <title>Zoomify example</title> <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link rel="stylesheet" href="http://openlayers.org/en/3.8.1/css/ol.css" type="text/css"> <script src="http://openlayers.org/en/3.8.1/build/ol.js"></script> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <div id="map" class="map"></div> </div> </div> </div> <script> // This server does not support CORS, and so is incompatible with WebGL. //var imgWidth = 8001; //var imgHeight = 6943; //var url = 'http://mapy.mzk.cz/AA22/0103/'; //var crossOrigin = undefined; var imgWidth = 9911; var imgHeight = 6100; var url = 'http://vips.vtech.fr/cgi-bin/iipsrv.fcgi?zoomify=' + '/mnt/MD1/AD00/plan_CHU-4HD-01/FOND.TIF/'; var crossOrigin = 'anonymous'; var imgCenter = [imgWidth / 2, - imgHeight / 2]; // Maps always need a projection, but Zoomify layers are not geo-referenced, and // are only measured in pixels. So, we create a fake projection that the map // can use to properly display the layer. var proj = new ol.proj.Projection({ code: 'ZOOMIFY', units: 'pixels', extent: [0, 0, imgWidth, imgHeight] }); var source = new ol.source.Zoomify({ url: url, size: [imgWidth, imgHeight], crossOrigin: crossOrigin }); var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: source }) ], target: 'map', view: new ol.View({ projection: proj, center: imgCenter, zoom: 0, // constrain the center: center cannot be set outside // this extent extent: [0, -imgHeight, imgWidth, 0] }) }); </script> </body> </html>