.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "GDAL2TILES" "1" "Aug 18, 2026" "" "GDAL" .SH NAME gdal2tiles \- Generates directory with TMS tiles, KMLs and simple web viewers. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX gdal2tiles [\-\-help] [\-\-help\-general] [\-\-legacy] [\-p ] [\-r resampling] [\-s ] [\-z ] [\-e] [\-a nodata] [\-v] [\-q] [\-h] [\-k] [\-n] [\-u ] [\-w ] [\-t ] [\-c <copyright>] [\-\-processes=<NB_PROCESSES>] [\-\-mpi] [\-\-xyz] [\-\-tilesize=<PIXELS>] \-\-tiledriver=<DRIVER> [\-\-tmscompatible] [\-\-excluded\-values=<EXCLUDED_VALUES>] [\-\-excluded\-values\-pct\-threshold=<EXCLUDED_VALUES_PCT_THRESHOLD>] [\-\-nodata\-values\-pct\-threshold=<NODATA_VALUES_PCT_THRESHOLD>] [\-g <googlekey] [\-b <bingkey>] <input_file> [<output_dir>] [<COMMON_OPTIONS>] .EE .UNINDENT .UNINDENT .SH DESCRIPTION .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 Starting with GDAL 3.13, \fBgdal2tiles\fP is deprecated, and by default is remapped to \fI\%gdal raster tile\fP\&. For now, you may force the use of the legacy code by specifying \fI\-\-legacy\fP, but legacy mode will be removed in GDAL 3.15. If you find yourself to need legacy mode and cannot find workarounds using gdal raster tile, please file a ticket at \X'tty: link https://github.com/OSGeo/GDAL'\fI\%https://github.com/OSGeo/GDAL\fP\X'tty: link' .UNINDENT .UNINDENT .sp This utility generates a directory with small tiles and metadata, following the OSGeo Tile Map Service Specification. Simple web pages with viewers based on Google Maps, OpenLayers and Leaflet are generated as well \- so anybody can comfortably explore your maps on\-line and you do not need to install or configure any special software (like MapServer) and the map displays very fast in the web browser. You only need to upload the generated directory onto a web server. .sp GDAL2Tiles also creates the necessary metadata for Google Earth (KML SuperOverlay), in case the supplied map uses EPSG:4326 projection. .sp World files and embedded georeferencing is used during tile generation, but you can publish a picture without proper georeferencing too. .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 Inputs with non\-Byte data type (i.e. \fBInt16\fP, \fBUInt16\fP,...) will be clamped to the \fBByte\fP data type, causing wrong results. To avoid this it is necessary to rescale input to the \fBByte\fP data type using \fIgdal_translate\fP utility. .UNINDENT .UNINDENT .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 Config options of the input drivers may have an effect on the output of gdal2tiles. An example driver config option is GDAL_PDF_DPI, which can be found at \fI\%Configuration options\fP .UNINDENT .UNINDENT .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 gdal2tiles is a Python utility, and is only available if GDAL Python bindings are available. .UNINDENT .UNINDENT .sp \fBTIP:\fP .INDENT 0.0 .INDENT 3.5 Equivalent in new \(dqgdal\(dq command line interface: .sp See \fI\%gdal raster tile\fP .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-\-help Show this help message and exit .UNINDENT .INDENT 0.0 .TP .B \-\-help\-general Gives a brief usage message for the generic GDAL commandline options and exit. .UNINDENT .INDENT 0.0 .TP .B \-\-legacy Added in version 3.13. .sp Force the use of the legacy code base. Since GDAL 3.13, by default, gdal2tiles is implemented using \fI\%gdal raster tile\fP\&. .UNINDENT .INDENT 0.0 .TP .B \-p <PROFILE>, \-\-profile=<PROFILE> Tile cutting profile (mercator, geodetic, raster) \- default \(aqmercator\(aq (Google Maps compatible). .sp Starting with GDAL 3.2, additional profiles are available from tms_XXXX.json files placed in GDAL data directory (provided all zoom levels use same origin, tile dimensions, and resolution between consecutive zoom levels vary by a factor of two). .UNINDENT .INDENT 0.0 .TP .B \-r <RESAMPLING>, \-\-resampling=<RESAMPLING> Resampling method (average, near, bilinear, cubic, cubicspline, lanczos, mode, max, min, med, q1, q3) \- default \(aqaverage\(aq. .UNINDENT .INDENT 0.0 .TP .B \-s <SRS>, \-\-s_srs=<SRS> The spatial reference system used for the source input data. .UNINDENT .INDENT 0.0 .TP .B \-\-xyz Generate XYZ tiles (OSM Slippy Map standard) instead of TMS. In the default mode (TMS), tiles at y=0 are the southern\-most tiles, whereas in XYZ mode (used by OGC WMTS too), tiles at y=0 are the northern\-most tiles. .sp Added in version 3.1. .UNINDENT .INDENT 0.0 .TP .B \-d, \-\-tmscompatible When using the geodetic profile, specifies the base resolution as 0.703125 or 2 tiles at zoom level 0. .UNINDENT .INDENT 0.0 .TP .B \-z <ZOOM>, \-\-zoom=<ZOOM> Zoom levels to render (format:\(aq2\-5\(aq, \(aq10\-\(aq or \(aq10\(aq). .UNINDENT .INDENT 0.0 .TP .B \-e, \-\-resume Resume mode. Generate only missing files. .UNINDENT .INDENT 0.0 .TP .B \-a <NODATA>, \-\-srcnodata=<NODATA> Value in the input dataset considered as transparent. If the input dataset had already an associate nodata value, it is overridden by the specified value. .UNINDENT .INDENT 0.0 .TP .B \-v, \-\-verbose Generate verbose output of tile generation. .sp Starting with GDAL 3.7, that verbose output is emitted through the \fBlogging.getLogger(\(dqgdal2tiles\(dq)\fP object. .UNINDENT .INDENT 0.0 .TP .B \-x, \-\-exclude Exclude transparent tiles from result tileset. .UNINDENT .INDENT 0.0 .TP .B \-q, \-\-quiet Disable messages and status to stdout .UNINDENT .INDENT 0.0 .TP .B \-\-processes=<NB_PROCESSES> Number of parallel processes to use for tiling, to speed\-up the computation. .UNINDENT .INDENT 0.0 .TP .B \-\-mpi Added in version 3.5. .sp Assume launched by mpiexec, enable MPI parallelism and ignore \-\-processes. Requires working MPI environment and the MPI for Python (mpi4py) package. User should set GDAL_CACHEMAX to an appropriate cache size per process based on memory per node and the number of processes launched per node. .sp \fBWARNING:\fP .INDENT 7.0 .INDENT 3.5 \-\-mpi mode is not supported in \fI\%gdal raster tile\fP non\-legacy mode. You may specify \fI\%\-\-legacy\fP to go on, but this legacy mode is going to be removed in GDAL 3.15. .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-\-tilesize=<PIXELS> Added in version 3.1. .sp Width and height in pixel of a tile. Default is 256. .UNINDENT .INDENT 0.0 .TP .B \-\-tiledriver=<DRIVER> Which output driver to use for the tiles, determines the file format of the tiles. Currently PNG, WEBP and JPEG (JPEG added in GDAL 3.9) are supported. Default is PNG. Additional configuration for the WEBP and JPEG drivers are documented below. .sp Added in version 3.6. .UNINDENT .INDENT 0.0 .TP .B \-\-excluded\-values=<EXCLUDED_VALUES> Comma\-separated tuple of values (thus typically \(dqR,G,B\(dq), that are ignored as contributing source pixels during resampling. The number of values in the tuple must be the same as the number of bands, excluding the alpha band. Several tuples of excluded values may be specified using the \(dq(R1,G1,B2),(R2,G2,B2)\(dq syntax. Only taken into account by Average currently. This concept is a bit similar to nodata/alpha, but the main difference is that pixels matching one of the excluded value tuples are still considered as valid, when determining the target pixel validity/density. .sp Added in version 3.9. .UNINDENT .INDENT 0.0 .TP .B \-\-excluded\-values\-pct\-threshold=EXCLUDED_VALUES_PCT_THRESHOLD Minimum percentage of source pixels that must be set at one of the \-\-excluded\-values to cause the excluded value, that is in majority among source pixels, to be used as the target pixel value. Default value is 50(%) .sp Added in version 3.9. .UNINDENT .INDENT 0.0 .TP .B \-\-nodata\-values\-pct\-threshold=<NODATA_VALUES_PCT_THRESHOLD> Minimum percentage of source pixels that must be at nodata (or alpha=0 or any other way to express transparent pixel) to cause the target pixel value to be transparent. Default value is 100 (%), which means that a target pixel is transparent only if all contributing source pixels are transparent. Only taken into account for average resampling. .sp Added in version 3.9. .UNINDENT .INDENT 0.0 .TP .B \-h, \-\-help Show help message and exit. .UNINDENT .INDENT 0.0 .TP .B \-\-version Show program\(aqs version number and exit. .UNINDENT .SS KML (Google Earth) options .sp Options for generated Google Earth SuperOverlay metadata .INDENT 0.0 .TP .B \-k, \-\-force\-kml Generate KML for Google Earth \- default for \(aqgeodetic\(aq profile and \(aqraster\(aq in EPSG:4326. For a dataset with different projection use with caution! .UNINDENT .INDENT 0.0 .TP .B \-n, \-\-no\-kml Avoid automatic generation of KML files for EPSG:4326. .UNINDENT .INDENT 0.0 .TP .B \-u <URL>, \-\-url=<URL> URL address where the generated tiles are going to be published. .UNINDENT .SS Web viewer options .sp Options for generated HTML viewers a la Google Maps .INDENT 0.0 .TP .B \-w <WEBVIEWER>, \-\-webviewer=<WEBVIEWER> Web viewer to generate (all, google, openlayers, leaflet, mapml, none) \- default \(aqall\(aq. .UNINDENT .INDENT 0.0 .TP .B \-t <TITLE>, \-\-title=<TITLE> Title of the map. .UNINDENT .INDENT 0.0 .TP .B \-c <COPYRIGHT>, \-\-copyright=<COPYRIGHT> Copyright for the map. .UNINDENT .INDENT 0.0 .TP .B \-g <GOOGLEKEY>, \-\-googlekey=<GOOGLEKEY> Google Maps API key from \X'tty: link https://developers.google.com/maps/get-started'\fI\%https://developers.google.com/maps/get\-started\fP\X'tty: link'\&. .UNINDENT .INDENT 0.0 .TP .B \-b <BINGKEY>, \-\-bingkey=<BINGKEY> Bing Maps API key from \X'tty: link https://www.bingmapsportal.com/'\fI\%https://www.bingmapsportal.com/\fP\X'tty: link' .UNINDENT .SS MapML options .sp MapML support is new to GDAL 3.2. When \-\-webviewer=mapml is specified, \-\-xyz is implied, as well as \-\-tmscompatible if \-\-profile=geodetic. .sp The following profiles are supported: .INDENT 0.0 .IP \(bu 2 mercator: mapped to OSMTILE MapML tiling scheme .IP \(bu 2 geodetic: mapped to WGS84 MapML tiling scheme .IP \(bu 2 APSTILE: from the tms_MapML_APSTILE.json data file .UNINDENT .sp The generated MapML file in the output directory is \fBmapml.mapml\fP .sp Available options are: .INDENT 0.0 .TP .B \-\-mapml\-template=<filename> Filename of a template mapml file where variables will be substituted. If not specified, the generic template_tiles.mapml file from GDAL data resources will be used .UNINDENT .sp The \-\-url option is also used to substitute \fB${URL}\fP in the template MapML file. .SS WEBP options .sp WEBP tiledriver support is new to GDAL 3.6. It is enabled by using \-\-tiledriver=WEBP. .sp The following configuration options are available to further customize the WebP output: .INDENT 0.0 .TP .B \-\-webp\-quality=<QUALITY> QUALITY is a integer between 1\-100. Default is 75. .UNINDENT .INDENT 0.0 .TP .B \-\-webp\-lossless Use WEBP lossless compression, default is lossy .UNINDENT .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 GDAL \fI\%WEBP driver\fP documentation can be consulted .UNINDENT .UNINDENT .SS JPEG options .sp JPEG tiledriver support is new to GDAL 3.9. It is enabled by using \-\-tiledriver=JPEG. .sp Note that JPEG does not support transparency, hence edge tiles will display black pixels in areas not covered by the source raster. .sp The following configuration options are available to further customize the JPEG output: .INDENT 0.0 .TP .B \-\-\-jpeg\-quality=JPEG_QUALITY QUALITY is a integer between 1\-100. Default is 75. .UNINDENT .SH RETURN STATUS CODE .sp The program returns status code 0 in case of success, and non\-zero in case of error (non\-blocking errors emitted as warnings are considered as a successful execution). .SH EXAMPLES .SS Example 1: Basic example .INDENT 0.0 .INDENT 3.5 .sp .EX gdal2tiles \-\-zoom=2\-5 input.tif output_folder .EE .UNINDENT .UNINDENT .SS Example 2: MapML generation .INDENT 0.0 .INDENT 3.5 .sp .EX gdal2tiles \-\-zoom=16\-18 \-w mapml \-p APSTILE \-\-url \(dqhttps://example.com\(dq input.tif output_folder .EE .UNINDENT .UNINDENT .SS Example 3: MPI example .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .EX mpiexec \-n $NB_PROCESSES gdal2tiles \-\-mpi \-\-config GDAL_CACHEMAX 500 \-\-zoom=2\-5 input.tif output_folder .EE .UNINDENT .UNINDENT .UNINDENT .UNINDENT .SH AUTHOR Klokan Petr Pridal <klokan@klokan.cz> .SH COPYRIGHT 1998-2026 .\" Generated by docutils manpage writer. .