GDAL-RASTER-TILE(1)
π GDAL-RASTER-TILE(1) π
okay so bestie, welcome to the gdal-raster-tile manual page β it lives in the GDAL manual, section 1. This one is giving main character energy and we're gonna get through all of it together. π
β¨ NAME β¨
gdal-raster-tile β generates tiles in separate files from a raster dataset. π
π¨ Oh and heads up: added in version 3.11. She's new, she's fresh, she ate. π
πΈ SYNOPSIS πΈ
Usage: gdal raster tile [OPTIONS] <INPUT> <OUTPUT>
Generate tiles in separate files from a raster dataset.
π Positional arguments π
-i,--dataset,--input<INPUT> β the input raster datasets you're feeding in. [required] [not available in pipelines] β οΈ (yes, you literally cannot do this without it, bestie)-o,--output<OUTPUT> β the output directory where all the little tile babies live. [required]
π§ Common Options π§
-h,--helpβ display the help message and exit. π the classic.--json-usageβ display usage as a JSON document and exit. machine-readable slay.--config<KEY>=<VALUE> β a configuration option. [may be repeated]-q,--quietβ quiet mode, meaning no progress bar and no warning message. [not available in pipelines] π€«
π Options π
-f,--of,--format,--output-format<OUTPUT-FORMAT> β the output format. (default:PNG)--co,--creation-option<KEY>=<VALUE> β a creation option. [may be repeated]--tiling-scheme<TILING-SCHEME> β the tiling scheme.TILING-SCHEME=raster|WebMercatorQuad|WorldCRS84Quad|WorldMercatorWGS84Quad|GoogleCRS84Quad|PseudoTMS_GlobalMercator|GlobalGeodeticOriginLat270|LINZAntarticaMapTilegrid|APSTILE|CBMTILE|NZTM2000(default:WebMercatorQuad)--min-zoom<MIN-ZOOM> β minimum zoom level.--max-zoom<MAX-ZOOM> β maximum zoom level.--min-x<MIN-X> β minimum tile X coordinate.--max-x<MAX-X> β maximum tile X coordinate.--min-y<MIN-Y> β minimum tile Y coordinate.--max-y<MAX-Y> β maximum tile Y coordinate.--no-intersection-okβ whether a dataset extent that does not intersect the tile matrix is only a warning. π«Ά (basically: is the "uh oh, no intersection" situation just a lil warning?)-r,--resampling<RESAMPLING> β resampling method used for the max zoom.RESAMPLING=nearest|bilinear|cubic|cubicspline|lanczos|average|rms|mode|min|max|med|q1|q3|sum(default:cubic)--overview-resampling<OVERVIEW-RESAMPLING> β resampling method used for the overviews.OVERVIEW-RESAMPLING=nearest|bilinear|cubic|cubicspline|lanczos|average|rms|mode|min|max|med|q1|q3|sum--convention<CONVENTION> β tile numbering convention:xyz(counting from the top) ortms(counting from the bottom).CONVENTION=xyz|tms(default:xyz)--tile-size<TILE-SIZE> β override the default tile size.--add-alphaβ whether to force adding an alpha channel. mutually exclusive with--no-alphaπ--no-alphaβ whether to disable adding an alpha channel. mutually exclusive with--add-alpha--output-nodata<OUTPUT-NODATA> β output nodata value.--skip-blankβ do not generate blank tiles. β blank tiles stay home.--metadata<KEY>=<VALUE> β add a metadata item to the output tiles. [may be repeated]--copy-src-metadataβ whether to copy metadata from the source dataset.--aux-xmlβ generate.aux.xmlsidecar files when needed.--kmlβ generate KML files.--resumeβ generate only the missing files. πββοΈ-j,--num-threads<NUM-THREADS> β number of jobs (orALL_CPUS). (default:ALL_CPUS)--parallel-method<PARALLEL-METHOD> β parallelization method:thread,spawn, orfork.PARALLEL-METHOD=thread|spawn|fork
π Advanced Options π
--if,--input-format<INPUT-FORMAT> β input formats. [may be repeated] [not available in pipelines]--oo,--open-option<KEY>=<VALUE> β open options. [may be repeated] [not available in pipelines]
π Advanced Resampling Options π
--excluded-values<EXCLUDED-VALUES> β tuples of values (like<R>,<G>,<B>or(<R1>,<G1>,<B1>),(<R2>,<G2>,<B2>)) that must be ignored as contributing source pixels during (average) resampling.--excluded-values-pct-threshold<EXCLUDED-VALUES-PCT-THRESHOLD> β minimum percentage of source pixels that must be set at one of the--excluded-valuesto cause the excluded value to be used as the target pixel value. (default:50)--nodata-values-pct-threshold<NODATA-VALUES-PCT-THRESHOLD> β minimum percentage of source pixels that must be set at one of nodata (oralpha=0or any other way to express a transparent pixel) to cause the target pixel value to be transparent. (default:100)
π¦ Publication Options π¦
--webviewer<WEBVIEWER> β web viewer to generate.WEBVIEWER=none|all|leaflet|openlayers|mapml|stac(default:all) [may be repeated]--url<URL> β the URL address where the generated tiles are going to be published.--title<TITLE> β title of the map.--copyright<COPYRIGHT> β copyright for the map.--mapml-template<MAPML-TEMPLATE> β filename of a template mapml file where variables will be substituted.
π DESCRIPTION π
okay so here's the whole vibe, bestie. gdal raster tile generates a directory with small tiles and metadata in it, following the OGC WMTS Specification. β¨
On top of that, simple web pages with viewers based on OpenLayers and Leaflet are generated as well β so literally 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. π The only thing you have to do is upload the generated directory onto a web server. periodt.
It generates PNG files by default, but other output formats can be selected (JPEG, WEBP, GTiff, etc.). π¨
β οΈ Careful though: not all formats support non-Byte data types.JPEGandWEBPonly support Byte.PNGsupports Byte and UInt16. GeoTiff can support all data types. π
It can also use a tiling scheme fully adapted to the input raster, in terms of origin and resolution, when using the raster tiling scheme. In that scheme, tiles at the maximum zoom level will have the same resolution as the raster. π
Starting with GDAL 3.12, gdal raster tile can be used as the last step of a pipeline. π
π PROGRAM-SPECIFIC OPTIONS π
okay bestie these are the actual fun ones, the flags that make this whole tiling thing go π
--aux-xmlβ makes.aux.xmlsidecar files whenever they're needed.--add-alphaβ forces an alpha channel to be added. lowkey it gets added by default anyway, unless the source dataset has a nodata value and the output format supports it. so this is you overriding the vibe check.--copy-src-metadataβ copies the metadata from the source dataset over into your output tiles. yes queen, inherit the lore.--conventionxyz|tms β which way do the tiles number themselves:- xyz (the default): numbering starts from the top, exactly like the OGC Web Map Tiling Specification (WMTS). π«Ά
- tms: numbering starts from the bottom, like the OSGeo Tile Map Service (TMS) Specification.
--output-nodata<NODATA> β the nodata value for the output. that's it, that's the tweet.-i,--input<INPUT> β your input raster dataset. this one is required, no skipping it π ββοΈ--kmlβ generates Google Earth SuperOverlay metadata. β οΈ but heads up: it is not compatible with tiling schemes that have non-power-of-two zoom levels. not compatible!! at all!!--max-x<MAX-X> β max tile X coordinate, at the maximum zoom level. use it to restrict the tiling process.--max-y<MAX-Y> β max tile Y coordinate, at the maximum zoom level. also there to restrict the tiling process.--max-zoom<MAX-ZOOM> β the biggest zoom level to generate. if you don't say anything, this gets figured out by comparing the resolution of your input dataset against the closest resolution in the tile matrix list of the tile matrix set. it's giving β¨automaticβ¨--metadata<KEY>=<VALUE> β drops a metadata item onto the output tiles. and listen β this one may be repeated. stack them like accessories π--min-x<MIN-X> β min tile X coordinate, at the maximum zoom level. restricts the tiling process.--min-y<MIN-Y> β min tile Y coordinate, at the maximum zoom level. restricts the tiling process.--min-zoom<MIN-ZOOM> β the smallest zoom level to generate. if you leave it out, it's equal to--max-zoom.--no-alphaβ turns OFF the creation of an alpha channel.--no-intersection-okβ makes it so that the dataset extent not intersecting the tile matrix is only a warning. otherwise, by default, it's an error if that happens. so this flag is basically "bestie i know, chill" π-j,--num-threads<value> β how many jobs run at once. default: however many CPUs get detected.-o,--output<OUTPUT> β output directory. required! and important: the directory itself will be created if it doesn't exist, but its parent directory must exist. don't ask me why, that's just the rule π--overview-resamplingnearest|bilinear|cubic|cubicspline|lanczos|average|rms|mode|min|max|med|q1|q3|sum β the resampling method used to generate zoom levels lower than the maximum zoom level. it defaults to whatever--resamplingis, if--resamplingisn't specified.--parallel-methodthread|spawn|fork β added in version GDAL: 3.12 β¨ here's how the parallelizing goes:- thread uses multi-threading, meaning the parallelized tasks all run within the same process.
- spawn launches child
gdalsub-processes. spawn can get you better "scaling", but it requires thegdalbinary to actually be available. GDAL will try to locate it, but you can also set theGDAL_PATHconfiguration option to point at the directory where thegdalbinary lives. - fork is a variant of spawn, using the system call
fork, without executing thegdalbinary. this method is not available on Windows. and on Unix systems where it is available, it's not recommended to use it on multithreaded processes β especially ones where other threads are doing GDAL operations β because it can potentially cause deadlocks. π yeah. noted.
if --parallel-method isn't specified, GDAL auto-decides which method is most appropriate: it opts for spawn if the gdal binary can be located and a sufficient number of tiles per job are being generated, and otherwise falls back to fork on Linux, MacOSX or FreeBSD (only if no other thread is running), and otherwise falls back to thread. it's choosing for you, trust the process π§
-r,--resamplingnearest|bilinear|cubic|cubicspline|lanczos|average|rms|mode|min|max|med|q1|q3|sum β the resampling method used for the maximum zoom level, and also for lower zoom levels if--overview-resamplingisn't specified. defaults tocubic.--resumeβ only generates the missing files. perfect for when you interrupt a previous run and want to restart it. the comeback tour π«Ά--skip-blankβ don't generate fully blank/transparent tiles. we're not keeping those, they didn't serve.--tile-size<PIXELS> β width and height of a tile, in pixels. default is256for the default tiling schemes. fun fact: setting it higher lets you generate higher DPI tile sets π--tiling-scheme<TILING-SCHEME> β the tile cutting scheme. defaults toWebMercatorQuad(also known as Google Maps compatible).
these are the base profiles available:
- raster: CRS = CRS of the raster, tile size =
256pixels, raster coverage at all zoom levels. - WebMercatorQuad: CRS =
EPSG:3857("WGS 84 / Pseudo-Mercator"), tile size:256pixels, whole world coverage at zoom level 0, one single tile at zoom level 0. - WorldCRS84Quad: CRS =
EPSG:4326("WGS 84"), tile size:256pixels, whole world coverage at zoom level 0, two side-by-side tiles at zoom level 0. - WorldMercatorWGS84Quad: CRS =
EPSG:3395("WGS 84 / World Mercator"), tile size:256pixels, whole world coverage at zoom level 0, one single tile at zoom level 0. think of it as a variant of WebMercatorQuad, except it's fully conformal on the WGS84 ellipsoid. slay. - GoogleCRS84Quad: CRS =
EPSG:4326("WGS 84"), tile size:256pixels, whole world coverage at zoom level 0, one single tile at zoom level 0 whose first and last64lines are blank (the top origin of the tile is a pseudo latitude of180degree, and its bottom-180degree). - PseudoTMS_GlobalMercator: CRS =
EPSG:3857("WGS 84 / Pseudo-Mercator"), tile size:256pixels, whole world coverage at zoom level 0, 2x2 tiles at zoom level 0. this is equivalent to WebMercatorQuad, but with the zoom level shifted by one. - LINZAntarticaMapTileGrid: LINZ Antarctic Map Tile Grid (Ross Sea Region). see
tms_LINZAntarticaMapTileGrid.json - APSTILE: Alaska Polar Stereographic-based tiled coordinate reference system for the Arctic region. see
tms_MapML_APSTILE.json - CBMTILE: Lambert Conformal Conic-based tiled coordinate reference system for Canada. see
tms_MapML_CBMTILE.json - NZTM2000: LINZ NZTM2000 Map Tile Grid. see
tms_NZTM2000.json
and bestie, extra tiling schemes get discovered from tms_XXXX.json files placed in the GDAL data directory. there's always more π
π§ͺ Advanced Resampling Options π§ͺ
these are the deep cuts. the ones where resampling gets very specific.
--excluded-values<EXCLUDED-VALUES> β a comma-separated tuple of values (so, typically"R,G,B") that get ignored as contributing source pixels during resampling. the number of values in the tuple must equal the number of bands, excluding the alpha band. you can specify several tuples of excluded values using the"(R1,G1,B2),(R2,G2,B2)"syntax. β οΈ this is only taken into account foraverageresampling. the concept is a bit similar to nodata/alpha, but the key difference is: pixels matching one of the excluded value tuples are still considered as valid when determining the target pixel validity/density. sneaky but intentional π
Added in version 3.11.1.
--excluded-values-pct-threshold<EXCLUDED-VALUES-PCT-THRESHOLD> β the minimum percentage of source pixels that must be set at one of the--excluded-valuesto cause the excluded value, the one that's in the majority among source pixels, to be used as the target pixel value. default value is50(%).
Added in version 3.11.1.
--nodata-values-pct-threshold<NODATA-VALUES-PCT-THRESHOLD> β the minimum percentage of source pixels that must be at nodata (oralpha=0, or any other way to express a transparent pixel) to cause the target pixel value to be transparent. default value is100(%), which means a target pixel is transparent only if all contributing source pixels are transparent. β οΈ only taken into account foraverageresampling.
Added in version 3.11.1.
π Publication Options π
--webviewernone|all|leaflet|openlayers|mapml|stac β which web viewer to generate. defaults toall. these viewers get created at the root of the output directory. andstacgenerates astacta.jsonfile, following the Spatio-Temporal Asset Catalog Tiled Assets specification, and that can be opened by the STACTA driver. iconic π--urlβ the URL address where the generated tiles are going to be published.--title<TITLE> β the title of the map. name her π--copyright<COPYRIGHT> β the copyright for the map.
πΊοΈ MapML options πΊοΈ
bestie listen: the MapML webviewer can only be generated if--conventionis set to the default valuexyz. that's the rule, no exceptions π
these are the profiles that are supported:
- WebMercatorQuad: mapped to the
OSMTILEMapML tiling scheme - GoogleCRS84Quad: mapped to the
WGS84MapML tiling scheme - APSTILE: from the
tms_MapML_APSTILE.jsondata file - CBMTILE: from the
tms_MapML_CBMTILE.jsondata file
the generated MapML file in the output directory is mapml.mapl.
the options available are:
--mapml-template<filename> β the filename of a templatemapmlfile where variables will be substituted. if you don't specify one, the generictemplate_tiles.mapmlfile from the GDAL data resources gets used instead. β¨
also heads up: the --url option is ALSO used to substitute ${URL} in the template MapML file. so don't forget about it, it's pulling double duty π«Ά
β¨ STANDARD OPTIONS β¨
okay bestie these are the glow-up options that basically every gdal command shares, so they're lowkey the universal cheat codes π
--co,--creation-option <NAME>=<VALUE>β soooo many formats have these little optional creation options that let you control the exact particulars of the file you're creating. Like, the GeoTIFF driver has creation options for controlling compression and whether the file should be tiled. Cute right? π
You can repeat this one as many times as you want. β¨
The creation options that actually exist vary by format driver, and some of the simple little formats have literally no creation options at all (they're giving minimalist π§). You can list the options a format supports with the --formats command line option, but fr fr the documentation for the format itself is the definitive source of info on driver creation options. Head to the Raster drivers format specific documentation for the legal creation options for each format. no cap π₯
--if,--input-format <format>β the format/driver name you want the tool to attempt to open your input file(s) with. ngl you generally don't need to specify it, but it's super handy for skipping automatic driver detection when the auto-detection is failing to pick the right driver. You can repeat this option several times to hand it a whole squad of candidate drivers. π
Careful though bestie β it does not force those drivers to open the dataset. Some drivers have requirements on file extensions, so it might still ghost you. π
May be repeated.
--oo,--open-option <NAME>=<VALUE>β dataset open option baby, and it's format specific. πΈ
May be repeated.
-f,--of,--format,--output-format <OUTPUT-FORMAT>β which output raster format are we serving today? π Allowed values may be given by:
gdal --formats | grep raster | grep rw | sort
Defaults to PNG. periodt. β¨
π«Ά RETURN STATUS CODE
The program returns status code 0 when it's slaying (success), and non-zero when something went wrong (error). Note that non-blocking errors emitted as warnings still count as a successful execution β they're just the tool being a lil dramatic, not actually failing you. π
π EXAMPLES
π« Example 1: Generate PNG tiles with WebMercatorQuad tiling scheme for zoom levels 2 to 5.
gdal raster tile --min-zoom=2 --max-zoom=5 input.tif output_folder
π« Example 2: Retile a raster using its origin and resolution
gdal raster tile --tiling-scheme raster input.tif output_folder
π« Example 3: Creating a tiled dataset, compatible of the Spatio-Temporal Asset Catalog Tiled Assets specification, using Cloud-Optimized GeoTIFF metatiles of dimension 4096x4096.
gdal raster tile --format COG --tile-size 4096 input.tif output_folder
π« Example 4: Mosaic on-the-fly several input files and tile that mosaic.
gdal raster pipeline ! mosaic input*.tif ! tile output_folder
π AUTHOR
Even Rouault <even.rouault@spatialys.com>
π COPYRIGHT
1998-2026
and that's the whole vibe bestie, we ate and left absolutely no crumbs π
β¨ this was GDAL-RASTER-TILE(1) from Aug 18, 2026 β go make some tiles, you absolute main character π¦π
π¦ where this page comes from
- alpine 3.24: gdal-doc 3.13.3-r0 Β· MIT
- arch rolling: gdal 3.13.3-6 Β· MIT
- ubuntu stonking: gdal-bin 3.13.3+dfsg-1ubuntu4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms