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 -x, --exclude
87 Exclude transparent tiles from result tileset.
88
89 -q, --quiet
90 Disable messages and status to stdout
91
92 New in version 2.1.
93
94
95 --processes=<NB_PROCESSES>
96 Number of parallel processes to use for tiling, to speed-up the
97 computation.
98
99 New in version 2.3.
100
101
102 --mpi Assume launched by mpiexec, enable MPI parallelism and ignore
103 --processes. Requires working MPI environment and the MPI for
104 Python (mpi4py) package. User should set GDAL_CACHEMAX to an
105 appropriate cache size per process based on memory per node and
106 the number of processes launched per node.
107
108 New in version 3.5.
109
110
111 --tilesize=<PIXELS>
112 Width and height in pixel of a tile. Default is 256.
113
114 New in version 3.1.
115
116
117 --tiledriver=<DRIVER>
118 Which output driver to use for the tiles, determines the file
119 format of the tiles. Currently PNG and WEBP are supported. De‐
120 fault is PNG. Additional configuration for the WEBP driver are
121 documented below.
122
123 New in version 3.6.
124
125
126 -h, --help
127 Show help message and exit.
128
129 --version
130 Show program's version number and exit.
131
132 KML (Google Earth) options
133 Options for generated Google Earth SuperOverlay metadata
134
135 -k, --force-kml
136 Generate KML for Google Earth - default for 'geodetic' profile
137 and 'raster' in EPSG:4326. For a dataset with different projec‐
138 tion use with caution!
139
140 -n, --no-kml
141 Avoid automatic generation of KML files for EPSG:4326.
142
143 -u <URL>, --url=<URL>
144 URL address where the generated tiles are going to be published.
145
146 Web viewer options
147 Options for generated HTML viewers a la Google Maps
148
149 -w <WEBVIEWER>, --webviewer=<WEBVIEWER>
150 Web viewer to generate (all, google, openlayers, leaflet, mapml,
151 none) - default 'all'.
152
153 -t <TITLE>, --title=<TITLE>
154 Title of the map.
155
156 -c <COPYRIGHT>, --copyright=<COPYRIGHT>
157 Copyright for the map.
158
159 -g <GOOGLEKEY>, --googlekey=<GOOGLEKEY>
160 Google Maps API key from
161 http://code.google.com/apis/maps/signup.html.
162
163 -b <BINGKEY>, --bingkey=<BINGKEY>
164 Bing Maps API key from https://www.bingmapsportal.com/
165
166 NOTE:
167 gdal2tiles.py is a Python script that needs to be run against Python
168 GDAL binding.
169
170 MapML options
171 MapML support is new to GDAL 3.2. When --webviewer=mapml is specified,
172 --xyz is implied, as well as --tmscompatible if --profile=geodetic.
173
174 The following profiles are supported:
175
176 • mercator: mapped to OSMTILE MapML tiling scheme
177
178 • geodetic: mapped to WGS84 MapML tiling scheme
179
180 • APSTILE: from the tms_MapML_APSTILE.json data file
181
182 The generated MapML file in the output directory is mapml.mapl
183
184 Available options are:
185
186 --mapml-template=<filename>
187 Filename of a template mapml file where variables will be sub‐
188 stituted. If not specified, the generic template_tiles.mapml
189 file from GDAL data resources will be used
190
191 The --url option is also used to substitute ${URL} in the template
192 MapML file.
193
194 WEBP options
195 WEBP tiledriver support is new to GDAL 3.6. It is enabled by using
196 --tiledriver=WEBP.
197
198 The following configuration options are available to further customize
199 the webp output:
200
201 --webp-quality=<QUALITY>
202 QUALITY is a integer between 1-100. Default is 75.
203
204 --webp-lossless
205 Use WEBP lossless compression, default is lossy
206
207 NOTE:
208 GDAL WEBP driver documentation can be consulted
209
211 Basic example:
212
213 gdal2tiles.py --zoom=2-5 input.tif output_folder
214
215 MapML generation:
216
217 gdal2tiles.py --zoom=16-18 -w mapml -p APSTILE --url "https://example.com" input.tif output_folder
218
219 MPI example:
220
221 mpiexec -n $NB_PROCESSES gdal2tiles.py --mpi --config GDAL_CACHEMAX 500 --zoom=2-5 input.tif output_folder
222
224 Klokan Petr Pridal <klokan@klokan.cz>
225
227 1998-2023
228
229
230
231
232 Apr 17, 2023 GDAL2TILES(1)