IIIF Georeference to XYZ Tiles
A tool for generating XYZ tiles from IIIF Georeference Extension JSON and displaying them with MapLibre GL JS. Repository: https://github.com/nakamura196/iiif-georef-tiles GitHub Pages: https://nakamura196.github.io/iiif-georef-tiles/ Requirements Python 3.x GDAL (gdal_translate, gdalwarp, gdal2tiles.py) Installing GDAL # macOS (Homebrew) brew install gdal # Ubuntu/Debian sudo apt install gdal-bin python3-gdal Usage python3 scripts/iiif_georef_to_tiles.py <IIIF_GEOREF_JSON_URL> Example python3 scripts/iiif_georef_to_tiles.py https://nakamura196.github.io/iiif_geo/canvas.json Options Option Default Description --scale 0.25 Image scale factor --zoom 14-18 Tile zoom level range --output-dir docs Output directory --name tiles Tile folder name --work-dir work Working directory --keep-work - Do not delete working files Processing Flow IIIF Georeference JSON │ ▼ ┌───────────────────────┐ │ 1. Fetch JSON │ │ (fetch from URL) │ └───────────────────────┘ │ ▼ ┌───────────────────────┐ │ 2. Download image │ │ (IIIF Image API) │ └───────────────────────┘ │ ▼ ┌───────────────────────┐ │ 3. Embed GCPs │ │ (gdal_translate) │ └───────────────────────┘ │ ▼ ┌───────────────────────┐ │ 4. Coordinate │ │ transformation │ │ (gdalwarp) │ └───────────────────────┘ │ ▼ ┌───────────────────────┐ │ 5. Generate tiles │ │ (gdal2tiles.py) │ └───────────────────────┘ │ ▼ ┌───────────────────────┐ │ 6. Generate HTML │ │ viewer │ │ (MapLibre GL JS) │ └───────────────────────┘ Conversion Results Original image After georeferencing Output Files docs/ ├── index.html # MapLibre GL JS viewer ├── source.json # Original IIIF Georeference JSON └── tiles/ # XYZ tiles ├── 14/ ├── 15/ ├── 16/ ├── 17/ └── 18/ Local Preview cd docs && python3 -m http.server 8000 # Open http://localhost:8000/ IIIF Georeference Extension The IIIF Georeference Extension is an extension specification for adding georeference information to IIIF images. ...
