Display DeepZoom (DZI) image tiles with Leaflet.
Originally based on Leaflet.Zoomify.
Using npm:
npm install leaflet-deepzoom
Using CDN (for quick demo or CodePen):
<script src="https://unpkg.com/leaflet-deepzoom@latest/leaflet-deepzoom.js"></script>
Live demo: π https://alfarisi.github.io/leaflet-deepzoom/example/
Basic example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Leaflet DeepZoom Example</title>
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
/>
<style>
#map { height: 100vh; }
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet-deepzoom@latest/leaflet-deepzoom.js"></script>
<script>
const map = L.map('map').setView([0, 0], 0);
var dzLayer = L.tileLayer.deepzoom('DeepZoomImage/hubble_files/', {
width: 2400,
height: 3000,
overlap: 1
}).addTo(map);
map.fitBounds(dzLayer.options.bounds);
</script>
</body>
</html>
| Leaflet Version | Plugin Version |
|---|---|
| 1.2.0 and later | 2.x |
| 0.7.x | 1.x (legacy) |
Released under the MIT License.