Skip to content

Instantly share code, notes, and snippets.

@mejackreed
Last active June 3, 2016 14:43
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mejackreed/f3904b28bb99abea32951f04ce6eb4cd to your computer and use it in GitHub Desktop.
Leaflet-IIIF Magnifying Glass Example

This example uses the Leaflet plugin Magnifying Glass.

The images being shown are multispectral versions of the Martellus map from Yale.

Using Leaflet-IIIF and the magnifying glass plugin, we can quickly provide a multispectral inspection.

Special thanks to Chet Van Duzer for help making this visualization possible. Additional thanks to the Beinecke Rare Book & Manuscript Library for providing these images. And last but not least, thanks to Ben Albritton for his work in accessioning the content and serving the images via IIIF.

var map;
map = L.map('map', {
center: [0, 0],
crs: L.CRS.Simple,
zoom: 0
});
var baseLayer = L.tileLayer.iiif(
'https://stacks.stanford.edu/image/iiif/zf275jj8939%2FMartellus_300ppi_natural_color_panorama_WIP2/info.json',
{
attribution: 'Images by Lazarus Project / MegaVision / RIT / EMEL, courtesy of the Beinecke Library, Yale University. Property rights reside with the Beinecke Library, Yale University. Copyright Yale University. All Rights Reserved.'
}
).addTo(map);
var magnifedLayer = L.tileLayer.iiif(
'https://stacks.stanford.edu/image/iiif/zf275jj8939%2FMartellus_300ppi_combined_processes_WIP2_panorama_with_blue_water/info.json',
{
attribution: 'Images by Lazarus Project / MegaVision / RIT / EMEL, courtesy of the Beinecke Library, Yale University. Property rights reside with the Beinecke Library, Yale University. Copyright Yale University. All Rights Reserved.'
}
);
var magnifyingGlass = L.magnifyingGlass({
layers: [magnifedLayer],
fixedZoom: 5,
radius: 150
}).addTo(map);
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/bbecquet/Leaflet.MagnifyingGlass/master/leaflet.magnifyingglass.css" />
<link rel="stylesheet" href="styles.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://rawgit.com/mejackreed/Leaflet-IIIF/master/leaflet-iiif.js"></script>
<script src="https://cdn.rawgit.com/bbecquet/Leaflet.MagnifyingGlass/leaflet-0.7.2/leaflet.magnifyingglass.js"></script>
</head>
<body>
<div id="map">
</div>
<script src="app.js"></script>
</body>
</html>
MIT License
Copyright (c) 2016 Jack Reed
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
html, body, #map{
height: 100%;
margin: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment