Code Monkey home page Code Monkey logo

leaflet-iiif's Introduction

Leaflet-IIIF

A Leaflet plugin for viewing IIIF images. See the demo

Requires Leaflet.js.

Leaflet-IIIF relies on browser support for Promise and Fetch API. If you need to support IE or other browsers without this, please use a polyfill.

Note on Leaflet Compatibility

Leaflet Versions Leaflet-IIIF Versions
< 1.0.0 < 1.0.0
>= 1.0 >= 1.0

Examples

Install with NPM

$ npm install leaflet-iiif --save

Quick and easy to get going.

import 'leaflet-iiif';

var map = L.map('map', {
  center: [0, 0],
  crs: L.CRS.Simple,
  zoom: 0
});

L.tileLayer.iiif('http://example.com/iiifimage.jp2/info.json').addTo(map);

Thanks to klokantech/iiifviewer and turban/Leaflet.Zoomify who have similar plugins which were used in development of Leaflet-IIIF.

Options

Leaflet-IIIF extends L.TileLayer and so many options available to L.TileLayer can be used with Leaflet-IIIF.

Option Type Default Description
tileFormat String 'jpg' The format of the returned image.
tileSize Number 256 Tile size (width and height in pixels, assuming tiles are square).
fitBounds Boolean true Automatically center and fit the maps bounds to the added IIIF layer
setMaxBounds Boolean false Constrain the map viewer to the image
quality String 'default' determines whether the image is delivered in color, grayscale or black and white Note: All IIIF servers do not support this parameter.

Development

Clone the repository

$ git clone https://github.com/mejackreed/Leaflet-IIIF.git

Install the dependencies

$ npm install

Run the server

$ npm start

Run the test suite

$ npm test

Access the examples at:

Leaflet-IIIF Examples

Leaflet-IIIF in the wild

leaflet-iiif's People

Contributors

2sc1815j avatar abrin avatar cbutcosk avatar eliotjordan avatar idoshamun avatar mejackreed avatar szmoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leaflet-iiif's Issues

demo failure (chrome + os x)

I’m very excited to see your Leaflet + IIIF work. It’s a super library, with a engaged/smart community behind it. So your efforts are appreciated.

The demo doesn’t seem to work for me on Chrome + OS X ; here’s what I see in the console:

Mixed Content: The page at 'https://mejackreed.github.io/Leaflet-IIIF/examples/example.html' was loaded over HTTPS, but requested an insecure stylesheet 'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css'. This request has been blocked; the content must be served over HTTPS.
example.html:1 Mixed Content: The page at 'https://mejackreed.github.io/Leaflet-IIIF/examples/example.html' was loaded over HTTPS, but requested an insecure script 'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js'. This request has been blocked; the content must be served over HTTPS.
leaflet-iiif.js:7 Uncaught ReferenceError: L is not defined
iiif-example.js:1 Uncaught ReferenceError: L is not defined

exception: smallestImage is undefined (imageSize is undefined)

If options.tileSize is greater than image size, you will have an exception as follows.

https://iiif.dl.itc.u-tokyo.ac.jp/omekac/iiif/6134/manifest
https://iiif.dl.itc.u-tokyo.ac.jp/omekac/iiif-img/1631/info.json

Leaflet 1.4.0+Leaflet-IIIF 2.0.1

jQuery.Deferred exception: smallestImage is undefined onAdd/<@https://rawgit.com/mejackreed/Leaflet-IIIF/v2.0.1/leaflet-iiif.js:81:1

Leaflet 0.7.7+Leaflet-IIIF 0.2.0

jQuery.Deferred exception: imageSize is undefined _fitBounds@https://rawgit.com/mejackreed/Leaflet-IIIF/v0.2.0/leaflet-iiif.js:94:9

(In Leaflet-IIIF 0.2.0, this will happen only when info.json lacks tiles property. This property is optional by spec. rel. #56)

This seems to be caused by the following points, _this.maxNativeZoom becomes -1.

_this.maxNativeZoom = Math.max(ceilLog2(_this.x / _this.options.tileSize),
          ceilLog2(_this.y / _this.options.tileSize));

Because of #64, I still have to use Leaflet-IIIF 0.2.0. The following workaround will be OK?

_this.maxNativeZoom = Math.max(ceilLog2(_this.x / _this.options.tileSize),
          ceilLog2(_this.y / _this.options.tileSize), 
          0);

Typescript support

It would be great if this project support typescript or has types declaration.

Inconsistency of height of tile images

In some cases, you can get inconsistent scaled tile images.
Please see the right bottom corner of the captured images.

tileSize: default
http://mejackreed.github.io/Leaflet-IIIF/examples/?url=https://iiif.dl.itc.u-tokyo.ac.jp/repo/iiif-img/155256/info.json
tilesize_default

tileSize: 1024
https://rawgit.com/2SC1815J/ed53d45d04742a52ae782cad1ef399e1/raw/0e6fe38f2353af66b1063fd7254c84cef437b316/iiif-example.html
tilesize_1024
(Image courtesy of the University of Tokyo General Library - “Kunshujou”)

These are displaying https://iiif.dl.itc.u-tokyo.ac.jp/repo/iiif-img/155256/info.json (width: 8317, height: 5479).
Leaflet-IIIF will try to get, for example,
https://iiif.dl.itc.u-tokyo.ac.jp/repo/iiif-img/155256/0,0,8192,5479/1024,/0/default.jpg
https://iiif.dl.itc.u-tokyo.ac.jp/repo/iiif-img/155256/8192,0,125,5479/16,/0/default.jpg
The IIIF image server returns 1024 x 684 px and 16 x 701 px images, these heights differ.

If you set tileSize smaller, this issue will be solved, is there any other solution?

Uncaught TypeError

Rendering manifests where canvases have identical labels

At Europeana we have found a problem with viewing some IIIF resources, like
http://www.europeana.eu/portal/fr/record/9200365/BibliographicResource_1000055020174.html

It seems that the problem happens when IIIF manifests have canvases with identical labels, such as this one, where all canvases have the same label (“NP”):
http://gallica.bnf.fr/iiif/ark:/12148/btv1b6000107x/manifest.json

A simple Leaflet rendering is
http://styleguide.europeana.eu/patterns/molecules-components-iiif/molecules-components-iiif.html?manifestUrl=http://gallica.bnf.fr/iiif/ark:/12148/btv1b6000107x/manifest.json

When loading in another IIIF viewer (Universal Viewer) the problem does not appear:
http://universalviewer.io/examples/?manifest=http://gallica.bnf.fr/iiif/ark:/12148/btv1b6000107x/manifest.json

Here’s another case, where only a subset of canvases have the same label:
http://styleguide.europeana.eu/patterns/molecules-components-iiif/molecules-components-iiif.html?manifestUrl=http://gallica.bnf.fr/iiif/ark:/12148/btv1b55005728g/manifest.json vs http://universalviewer.io/examples/?manifest=http://gallica.bnf.fr/iiif/ark:/12148/btv1b55005728g/manifest.json

In this example the ToC / order or pages is not the same as specified in the manifest. There are several canvases with “NP” label at the beginning, which may well have disappeared.

npm version and publish

would it be possible to do a npm version minor and npm publish of the repo now that there's a version that doesn't have jQuery? This would enable us to test more easily.

Also, I think we might be able to close this ticket: #46

Demo Broken

The Manifest demo appears to be broken, at least for me.

Chrome on windows 7.

Getting the JS error 'Cannot read property 'maxzoom' of undefined!

Support for images not served by IIIF server?

Hi,
Thanks for your work on this. I am interested in using Leaflet for image annotation, and in addition to working with IIIF-served images, offering the option of annotating local images which are not tiled or provided by an IIIF server. As I understand it this is the most basic level of the IIIF spec (?).
Is there any recommended approach for this in Leaflet-IIIF or should I just look to existing Leaflet functionality to achieve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.