image2leaflet
A command line tool for converting (big) images to Leaflet maps. Works with huge images, even with ones bigger than available memory.
Installation
Windows
Install Python 2.7 for Windows from:
https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi
SelectAdd python.exe to Path
in the installer!Install GDAL core from:
http://download.gisinternals.com/sdk/downloads/release-1500-gdal-1-11-4-mapserver-6-4-3/gdal-111-1500-core.msiInstall GDAL Python bindings from:
http://download.gisinternals.com/sdk/downloads/release-1500-gdal-1-11-4-mapserver-6-4-3/GDAL-1.11.4.win32-py2.7.msi-
Set GDAL environment variables (from command line):
setx PATH "%path%;C:\Program Files (x86)\GDAL" setx GDAL_DATA "C:\Program Files (x86)\GDAL\gdal-data" setx GDAL_DRIVER_PATH "C:\Program Files (x86)\GDAL\gdalplugins"
-
Install mozjpeg:
- Download zip from: https://mozjpeg.codelove.de/bin/mozjpeg_3.1_x86.zip
- Extract it to
C:\Program Files (x86)\mozjpeg
-
Install image2leaflet:
- Close and reopen the command line window
-
run
pip install image2leaflet
OS X
-
Install dependencies with homebrew
brew install python brew install gdal brew install mozjpeg
-
Install image2leaflet
pip install image2leaflet
Usage
From command line, simply run
image2leaflet bigimage.tif
Which will create a tiled Leaflet map in bigimage
subfolder.
By default the output folder is relative to the image file. You can override it by specifying -o
our --output
for example:
image2leaflet bigimage.tif -o my-new-subfolder
The exported format can be either in JPEG (default) or PNG. You can select it using -f
or --format
switch.
image2leaflet bigimage.tif -f png