Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Usage Instructions for gdal2tiles_parallel.py

stevendlander edited this page Dec 15, 2014 · 1 revision

Purpose

This document covers installation of dependencies, in-depth explanations of command-line arguments, and usage examples for gdal2tiles parallel.py. The file gdal2tiles parallel.py is a Python script that converts GDAL-supported raster imagery files into a folder of tiles in TMS format (z/x/y). This version improves upon the standard gdal2tiles.py file included with GDAL by adding multiprocessing improvements to obtain even better tile generation performance.

Installing Dependencies

Gdal2tiles parallel.py was written for Python 2.7.x and has not been tested on any other version. It will run on either 32 or 64 bit systems with no issues. The script relies on Python 2.7.x, GDAL core, and the GDAL Python bindings. Some imagery formats such as MrSID will require additional driver installers to work correctly. Please see the wiki page for installing dependencies for more information.

Usage

Command Line Arguments

Gdal2tiles parallel.py supports additional functionality via command line arguments provided to the script at the time it is executed. Following is a outline of the important flags:

-h, -help      Print the listing of commands available for the script.

-p, –profile   Specify the tiling profile you would like these tiles to be created in. Valid options are
               mercator or geodetic.

-e, -resume    Instruct the script to not overwrite tiles that have already been created. This is a
               *mandatory* flag when using default multiprocessing.

-z, -zoom      The zoom levels to create. Allows the tiler to make tiles past the default zoom level that
               GDAL detects. (Format: ’2-5’ or ’10’)

-a, -srcnodata Specify the RGB value that gdal2tiles should convert to transparency. Typical value should
               be ’0,0,0’.

Examples

  • Create a folder of tiles in the mercator projection based on a GeoTiff image named WhiteHorse.tif and name the folder ’WhiteHorse tiles’:

      python gdal2tiles_parallel.py -e -p mercator /data/raw/WhiteHorse.tif /data/tiles/mercator/WhiteHorse_tiles
    
  • Create a folder of tiles for zoom level 15 in the mercator projection based on a GeoTiff image named WhiteHorse.tif and name the folder ’WhiteHorse tiles’:

      python gdal2tiles_parallel.py -p mercator -e -z 15 /data/raw/WhiteHorse.tif /data/tiles/mercator/WhiteHorse_tiles
    
  • Create a folder of tiles in the geodetic projection based on a MrSID image named FortBelvoir 201307 A6.sid and name the folder belvoir tiles. Also, assigns the NODATA transparency to the RGB color value of 0,0,0:

      python gdal2tiles_parallel.py -p geodetic -e -a 0,0,0 /data/raw/FortBelvoir_201307_A6.sid /data/tiles/belvoir_tiles
    
  • Create a folder of tiles in the geodetic projection based on a MrSID image named FortBelvoir 201307 A6.sid and name the folder belvoir tiles. Also, assigns the NODATA transparency to the RGB color value of 255,0,0:

      python gdal2tiles_parallel.py -p geodetic -e -a 255,0,0 /data/raw/FortBelvoir_201307_A6.sid /data/tiles/belvoir_tiles
    
  • Create a folder of tiles for zoom levels 10 through 13 in the geodetic projection based on a MrSID image named FortBelvoir 201307 A6.sid and name the folder belvoir tiles. Also, assigns the NODATA transparency to the RGB color value of 0,0,0:

      python gdal2tiles_parallel.py -p geodetic -e -a 0,0,0 -z 10-13 /data/raw/FortBelvoir_201307_A6.sid /data/tiles/belvoir_tiles
    

Known Issues

Refer to the issues on this repository for an up-to-date listing of known issues and their status.