GDAL2TILES(1)
π
gdal2tiles β welcome to the GDAL2TILES(1) page, bestie π
okay so this is the manual for gdal2tiles, and it is lowkey iconic. Letβs get into it. π«Ά
πΈ NAME πΈ
gdal2tiles β Generates directory with TMS tiles, KMLs and simple web viewers. Thatβs the whole assignment. β¨
π¦ SYNOPSIS π¦
Hereβs the shape of the command, no cap:
gdal2tiles.py [-p profile] [-r resampling] [-s srs] [-z zoom]
[-e] [-a nodata] [-v] [-q] [-h] [-k] [-n] [-u url]
[-w webviewer] [-t title] [-c copyright]
[--processes=NB_PROCESSES] [--xyz]
--tilesize=PIXELS
[-g googlekey] [-b bingkey] input_file [output_dir] [COMMON_OPTIONS]
β¨ DESCRIPTION β¨
Okay so 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. Slay. π
GDAL2Tiles also creates the necessary metadata for Google Earth (KML SuperOverlay), in case the supplied map uses EPSG:4326 projection. π°οΈ
World files and embedded georeferencing is used during tile generation, but you can publish a picture without proper georeferencing too. The range! π
β οΈ NOTE: Inputs with non-Byte data type (i.e.Int16,UInt16,...) will be clamped to the Byte data type, causing wrong results. To avoid this it is necessary to rescale input to the Byte data type usinggdal_translateutility. Do not skip this, fr fr. π
β οΈ NOTE: Config options of the input drivers may have an effect on the output ofgdal2tiles. An example driver config option isGDAL_PDF_DPI, which can be found atconfigoptions. iykyk. π
π OPTIONS π
-p <PROFILE>,--profile=<PROFILE>β Tile cutting profile (mercator,geodetic,raster) β default'mercator'(Google Maps compatible). Starting with GDAL 3.2, additional profiles are available fromtms_XXXX.jsonfiles 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).-r <RESAMPLING>,--resampling=<RESAMPLING>β Resampling method (average,near,bilinear,cubic,cubicspline,lanczos,antialias,mode,max,min,med,q1,q3) β default'average'. Pick your fighter. π₯-s <SRS>,--s_srs=<SRS>β The spatial reference system used for the source input data.--xyzβ Generate XYZ tiles (OSM Slippy Map standard) instead of TMS. In the default mode (TMS), tiles aty=0are the southern-most tiles, whereas in XYZ mode (used by OGC WMTS too), tiles aty=0are the northern-most tiles. β¨ New in version 3.1.-z <ZOOM>,--zoom=<ZOOM>β Zoom levels to render (format:'2-5','10-'or'10'). ποΈ-e,--resumeβ Resume mode. Generate only missing files. Efficient queen behavior.-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.-v,--verboseβ Generate verbose output of tile generation.-x,--excludeβ Exclude transparent tiles from result tileset.-q,--quietβ Disable messages and status to stdout. β¨ New in version 2.1.--processes=<NB_PROCESSES>β Number of parallel processes to use for tiling, to speed-up the computation. β¨ New in version 2.3.--tilesize=<PIXELS>β Width and height in pixel of a tile. Default is256. β¨ New in version 3.1.-h,--helpβ Show help message and exit.--versionβ Show program's version number and exit.
π§ KML (Google Earth) options π§
Options for generated Google Earth SuperOverlay metadata. Cute, right? π
-k,--force-kmlβ Generate KML for Google Earth β default for'geodetic'profile and'raster'in EPSG:4326. For a dataset with different projection use with caution! β οΈ-n,--no-kmlβ Avoid automatic generation of KML files for EPSG:4326.-u <URL>,--url=<URL>β URL address where the generated tiles are going to be published.
π Web viewer options π
Options for generated HTML viewers a la Google Maps. Very main character. π
-w <WEBVIEWER>,--webviewer=<WEBVIEWER>β Web viewer to generate (all,google,openlayers,leaflet,mapml,none) β default'all'.-t <TITLE>,--title=<TITLE>β Title of the map.-c <COPYRIGHT>,--copyright=<COPYRIGHT>β Copyright for the map.-g <GOOGLEKEY>,--googlekey=<GOOGLEKEY>β Google Maps API key fromhttp://code.google.com/apis/maps/signup.html.-b <BINGKEY>,--bingkey=<BINGKEY>β Bing Maps API key fromhttps://www.bingmapsportal.com/.
π NOTE: gdal2tiles.py is a Python script that needs to be run against Python GDAL binding. Okurrr.
πΊοΈ MapML options πΊοΈ
MapML support is new to GDAL 3.2. When --webviewer=mapml is specified, --xyz is implied, as well as --tmscompatible if --profile=geodetic. The way that combo just clicks. β¨
The following profiles are supported:
mercator: mapped to OSMTILE MapML tiling schemegeodetic: mapped to WGS84 MapML tiling schemeAPSTILE: from thetms_MapML_APSTILE.jsondata file
The generated MapML file in the output directory is mapml.mapl. Not a typo, bestie. π
Available options are:
--mapml-template=<filename>β Filename of a template mapml file where variables will be substituted. If not specified, the generictemplate_tiles.mapmlfile from GDAL data resources will be used.
The --url option is also used to substitute ${URL} in the template MapML file.
π₯ EXAMPLES π₯
Basic example:
gdal2tiles.py --zoom=2-5 input.tif output_folder
MapML generation:
gdal2tiles.py --zoom=16-18 -w mapml -p APSTILE --url "https://example.com" input.tif output_folder
π AUTHOR π
Klokan Petr Pridal <klokan@klokan.cz> β icon behavior. π
π COPYRIGHT π
1998-2026
Thatβs the GDAL2TILES(1) manual, source/version GDAL, dated Jan 08, 2026. Byeee bestie, go tile something iconic! π«Άππ
π¦ where this page comes from
- epel 9: gdal3.4-python-tools 3.4.3-5.el9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms