1GDAL2TILES(1) GDAL GDAL2TILES(1)
2
3
4
6 gdal2tiles - Generates directory with TMS tiles, KMLs and simple web
7 viewers.
8
10 gdal2tiles.py [-p profile] [-r resampling] [-s srs] [-z zoom]
11 [-e] [-a nodata] [-v] [-q] [-h] [-k] [-n] [-u url]
12 [-w webviewer] [-t title] [-c copyright]
13 [--processes=NB_PROCESSES] [--mpi] [--xyz]
14 [--tilesize=PIXELS] [--tmscompatible]
15 [-g googlekey] [-b bingkey] input_file [output_dir] [COMMON_OPTIONS]
16
18 This utility generates a directory with small tiles and metadata, fol‐
19 lowing the OSGeo Tile Map Service Specification. Simple web pages with
20 viewers based on Google Maps, OpenLayers and Leaflet are generated as
21 well - so anybody can comfortably explore your maps on-line and you do
22 not need to install or configure any special software (like MapServer)
23 and the map displays very fast in the web browser. You only need to up‐
24 load the generated directory onto a web server.
25
26 GDAL2Tiles also creates the necessary metadata for Google Earth (KML
27 SuperOverlay), in case the supplied map uses EPSG:4326 projection.
28
29 World files and embedded georeferencing is used during tile generation,
30 but you can publish a picture without proper georeferencing too.
31
32 NOTE:
33 Inputs with non-Byte data type (i.e. Int16, UInt16,...) will be
34 clamped to the Byte data type, causing wrong results. To avoid this
35 it is necessary to rescale input to the Byte data type using
36 gdal_translate utility.
37
38 NOTE:
39 Config options of the input drivers may have an effect on the output
40 of gdal2tiles. An example driver config option is GDAL_PDF_DPI,
41 which can be found at Configuration options
42
43 -p <PROFILE>, --profile=<PROFILE>
44 Tile cutting profile (mercator, geodetic, raster) - default
45 'mercator' (Google Maps compatible).
46
47 Starting with GDAL 3.2, additional profiles are available from
48 tms_XXXX.json files placed in GDAL data directory (provided all
49 zoom levels use same origin, tile dimensions, and resolution be‐
50 tween consecutive zoom levels vary by a factor of two).
51
52 -r <RESAMPLING>, --resampling=<RESAMPLING>
53 Resampling method (average, near, bilinear, cubic, cubicspline,
54 lanczos, antialias, mode, max, min, med, q1, q3) - default 'av‐
55 erage'.
56
57 -s <SRS>, --s_srs=<SRS>
58 The spatial reference system used for the source input data.
59
60 --xyz Generate XYZ tiles (OSM Slippy Map standard) instead of TMS. In
61 the default mode (TMS), tiles at y=0 are the southern-most
62 tiles, whereas in XYZ mode (used by OGC WMTS too), tiles at y=0
63 are the northern-most tiles.
64
65 New in version 3.1.
66
67
68 -d, --tmscompatible
69 When using the geodetic profile, specifies the base resolution
70 as 0.703125 or 2 tiles at zoom level 0.
71
72 -z <ZOOM>, --zoom=<ZOOM>
73 Zoom levels to render (format:'2-5', '10-' or '10').
74
75 -e, --resume
76 Resume mode. Generate only missing files.
77
78 -a <NODATA>, --srcnodata=<NODATA>
79 Value in the input dataset considered as transparent. If the in‐
80 put dataset had already an associate nodata value, it is over‐
81 ridden by the specified value.
82
83 -v, --verbose
84 Generate verbose output of tile generation.
85
86 Starting with GDAL 3.7, that verbose output is emitted through
87 the logging.getLogger("gdal2tiles") object.
88
89 -x, --exclude
90 Exclude transparent tiles from result tileset.
91
92 -q, --quiet
93 Disable messages and status to stdout
94
95 New in version 2.1.
96
97
98 --processes=<NB_PROCESSES>
99 Number of parallel processes to use for tiling, to speed-up the
100 computation.
101
102 New in version 2.3.
103
104
105 --mpi Assume launched by mpiexec, enable MPI parallelism and ignore
106 --processes. Requires working MPI environment and the MPI for
107 Python (mpi4py) package. User should set GDAL_CACHEMAX to an
108 appropriate cache size per process based on memory per node and
109 the number of processes launched per node.
110
111 New in version 3.5.
112
113
114 --tilesize=<PIXELS>
115 Width and height in pixel of a tile. Default is 256.
116
117 New in version 3.1.
118
119
120 --tiledriver=<DRIVER>
121 Which output driver to use for the tiles, determines the file
122 format of the tiles. Currently PNG and WEBP are supported. De‐
123 fault is PNG. Additional configuration for the WEBP driver are
124 documented below.
125
126 New in version 3.6.
127
128
129 -h, --help
130 Show help message and exit.
131
132 --version
133 Show program's version number and exit.
134
135 KML (Google Earth) options
136 Options for generated Google Earth SuperOverlay metadata
137
138 -k, --force-kml
139 Generate KML for Google Earth - default for 'geodetic' profile
140 and 'raster' in EPSG:4326. For a dataset with different projec‐
141 tion use with caution!
142
143 -n, --no-kml
144 Avoid automatic generation of KML files for EPSG:4326.
145
146 -u <URL>, --url=<URL>
147 URL address where the generated tiles are going to be published.
148
149 Web viewer options
150 Options for generated HTML viewers a la Google Maps
151
152 -w <WEBVIEWER>, --webviewer=<WEBVIEWER>
153 Web viewer to generate (all, google, openlayers, leaflet, mapml,
154 none) - default 'all'.
155
156 -t <TITLE>, --title=<TITLE>
157 Title of the map.
158
159 -c <COPYRIGHT>, --copyright=<COPYRIGHT>
160 Copyright for the map.
161
162 -g <GOOGLEKEY>, --googlekey=<GOOGLEKEY>
163 Google Maps API key from
164 http://code.google.com/apis/maps/signup.html.
165
166 -b <BINGKEY>, --bingkey=<BINGKEY>
167 Bing Maps API key from https://www.bingmapsportal.com/
168
169 NOTE:
170 gdal2tiles.py is a Python script that needs to be run against Python
171 GDAL binding.
172
173 MapML options
174 MapML support is new to GDAL 3.2. When --webviewer=mapml is specified,
175 --xyz is implied, as well as --tmscompatible if --profile=geodetic.
176
177 The following profiles are supported:
178
179 • mercator: mapped to OSMTILE MapML tiling scheme
180
181 • geodetic: mapped to WGS84 MapML tiling scheme
182
183 • APSTILE: from the tms_MapML_APSTILE.json data file
184
185 The generated MapML file in the output directory is mapml.mapl
186
187 Available options are:
188
189 --mapml-template=<filename>
190 Filename of a template mapml file where variables will be sub‐
191 stituted. If not specified, the generic template_tiles.mapml
192 file from GDAL data resources will be used
193
194 The --url option is also used to substitute ${URL} in the template
195 MapML file.
196
197 WEBP options
198 WEBP tiledriver support is new to GDAL 3.6. It is enabled by using
199 --tiledriver=WEBP.
200
201 The following configuration options are available to further customize
202 the webp output:
203
204 --webp-quality=<QUALITY>
205 QUALITY is a integer between 1-100. Default is 75.
206
207 --webp-lossless
208 Use WEBP lossless compression, default is lossy
209
210 NOTE:
211 GDAL WEBP driver documentation can be consulted
212
214 Basic example:
215
216 gdal2tiles.py --zoom=2-5 input.tif output_folder
217
218 MapML generation:
219
220 gdal2tiles.py --zoom=16-18 -w mapml -p APSTILE --url "https://example.com" input.tif output_folder
221
222 MPI example:
223
224 mpiexec -n $NB_PROCESSES gdal2tiles.py --mpi --config GDAL_CACHEMAX 500 --zoom=2-5 input.tif output_folder
225
227 Klokan Petr Pridal <klokan@klokan.cz>
228
230 1998-2023
231
232
233
234
235 Oct 30, 2023 GDAL2TILES(1)