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
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 -z <ZOOM>, --zoom=<ZOOM>
69 Zoom levels to render (format:'2-5', '10-' or '10').
70
71 -e, --resume
72 Resume mode. Generate only missing files.
73
74 -a <NODATA>, --srcnodata=<NODATA>
75 Value in the input dataset considered as transparent. If the in‐
76 put dataset had already an associate nodata value, it is over‐
77 ridden by the specified value.
78
79 -v, --verbose
80 Generate verbose output of tile generation.
81
82 -x, --exclude
83 Exclude transparent tiles from result tileset.
84
85 -q, --quiet
86 Disable messages and status to stdout
87
88 New in version 2.1.
89
90
91 --processes=<NB_PROCESSES>
92 Number of parallel processes to use for tiling, to speed-up the
93 computation.
94
95 New in version 2.3.
96
97
98 --mpi Assume launched by mpiexec, enable MPI parallelism and ignore
99 --processes. Requires working MPI environment and the MPI for
100 Python (mpi4py) package. User should set GDAL_CACHEMAX to an
101 appropriate cache size per process based on memory per node and
102 the number of processes launched per node.
103
104 New in version 3.5.
105
106
107 --tilesize=<PIXELS>
108 Width and height in pixel of a tile. Default is 256.
109
110 New in version 3.1.
111
112
113 -h, --help
114 Show help message and exit.
115
116 --version
117 Show program's version number and exit.
118
119 KML (Google Earth) options
120 Options for generated Google Earth SuperOverlay metadata
121
122 -k, --force-kml
123 Generate KML for Google Earth - default for 'geodetic' profile
124 and 'raster' in EPSG:4326. For a dataset with different projec‐
125 tion use with caution!
126
127 -n, --no-kml
128 Avoid automatic generation of KML files for EPSG:4326.
129
130 -u <URL>, --url=<URL>
131 URL address where the generated tiles are going to be published.
132
133 Web viewer options
134 Options for generated HTML viewers a la Google Maps
135
136 -w <WEBVIEWER>, --webviewer=<WEBVIEWER>
137 Web viewer to generate (all, google, openlayers, leaflet, mapml,
138 none) - default 'all'.
139
140 -t <TITLE>, --title=<TITLE>
141 Title of the map.
142
143 -c <COPYRIGHT>, --copyright=<COPYRIGHT>
144 Copyright for the map.
145
146 -g <GOOGLEKEY>, --googlekey=<GOOGLEKEY>
147 Google Maps API key from
148 http://code.google.com/apis/maps/signup.html.
149
150 -b <BINGKEY>, --bingkey=<BINGKEY>
151 Bing Maps API key from https://www.bingmapsportal.com/
152
153 NOTE:
154 gdal2tiles.py is a Python script that needs to be run against Python
155 GDAL binding.
156
157 MapML options
158 MapML support is new to GDAL 3.2. When --webviewer=mapml is specified,
159 --xyz is implied, as well as --tmscompatible if --profile=geodetic.
160
161 The following profiles are supported:
162
163 • mercator: mapped to OSMTILE MapML tiling scheme
164
165 • geodetic: mapped to WGS84 MapML tiling scheme
166
167 • APSTILE: from the tms_MapML_APSTILE.json data file
168
169 The generated MapML file in the output directory is mapml.mapl
170
171 Available options are:
172
173 --mapml-template=<filename>
174 Filename of a template mapml file where variables will be sub‐
175 stituted. If not specified, the generic template_tiles.mapml
176 file from GDAL data resources will be used
177
178 The --url option is also used to substitute ${URL} in the template
179 MapML file.
180
182 Basic example:
183
184 gdal2tiles.py --zoom=2-5 input.tif output_folder
185
186 MapML generation:
187
188 gdal2tiles.py --zoom=16-18 -w mapml -p APSTILE --url "https://example.com" input.tif output_folder
189
190 MPI example:
191
192 mpiexec -n $NB_PROCESSES gdal2tiles.py --mpi --config GDAL_CACHEMAX 500 --zoom=2-5 input.tif output_folder
193
195 Klokan Petr Pridal <klokan@klokan.cz>
196
198 1998-2022
199
200
201
202
203 Sep 02, 2022 GDAL2TILES(1)