Skip to main content

A fork of gdal2tiles without gdal specified so that it can easily be installed in a virtual environment. A python library for generating map tiles based on script.

Project description

gdal2tiles Documentation Status

A python library for generating map tiles inspired by from GDAL project.


  • GDAL development header files, sometimes available as libgdal-dev or libgdal-devel packages.


To install gdal2tiles library you can use pip:

$ pip install gdal2tiles

Basic usage

import gdal2tiles

gdal2tiles.generate_tiles('/path/to/input_file', '/path/to/output_dir/')

You can also pass various keyword as optional keyword arguments to generate_tiles() function. For example

gdal2tiles.generate_tiles('input_file', 'output_dir/', nb_processes=2, zoom='7-9')


options = {'zoom': (7, 9), 'resume': True}
gdal2tiles.generate_tiles('input_file', 'output_dir/', **options)

In general

gdal2tiles.generate_tiles(input_file, output_folder, **options)


input_file (str): Path to input file.

output_folder (str): Path to output folder.

options: Tile generation options.

profile (str): Tile cutting profile (mercator,geodetic,raster) - default

‘mercator’ (Google Maps compatible)

resampling (str): Resampling method (average,near,bilinear,cubic,cubicsp

line,lanczos,antialias) - default ‘average’

s_srs: The spatial reference system used for the source input data

zoom: Zoom levels to render; format: [int min, int max],

‘min-max’ or int/str zoomlevel.

resume (bool): Resume mode. Generate only missing files.

srcnodata: NODATA transparency value to assign to the input data

tmscompatible (bool): When using the geodetic profile, specifies the base

resolution as 0.703125 or 2 tiles at zoom level 0.

verbose (bool): Print status messages to stdout

kml (bool): Generate KML for Google Earth - default for ‘geodetic’

profile and ‘raster’ in EPSG:4326. For a dataset with different projection use with caution!

url (str): URL address where the generated tiles are going to be published

webviewer (str): Web viewer to generate (all,google,openlayers,none) -

default ‘all’

title (str): Title of the map

copyright (str): Copyright for the map

googlekey (str): Google Maps API key from

bingkey (str): Bing Maps API key from

nb_processes: Number of processes to use for tiling.


0.1.0 (2018-05-06)

  • First release on PyPI.

0.1.1 (2018-05-10)

  • Clean the source code.

  • Setup documentation

  • Setup testing environment

0.1.2 (2018-05-16)

  • Bug fix in generate_tiles().

0.1.3 (2018-07-31)

  • Use billard for multiprocessing if available.

0.1.4 (2018-08-14)

  • Accept list or tuple in specifying tile generation zoom level.

0.1.5 (2018-08-14)

  • Bug fix.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygdal2tiles-0.1.9.tar.gz (39.6 kB view hashes)

Uploaded source

Built Distribution

pygdal2tiles-0.1.9-py2.py3-none-any.whl (34.0 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page