![]() |
![]()
| ![]() |
![]()
NAMEgdaladdo - Builds or rebuilds overview images. SYNOPSISUsage: gdaladdo [--help] [--long-usage] [--help-general] DESCRIPTIONThe gdaladdo utility can be used to build or rebuild overview images for most supported file formats with one of several downsampling algorithms.
gdaladdo will honour properly NODATA_VALUES tuples (special dataset metadata) so that only a given RGB triplet (in case of a RGB image) will be considered as the nodata value and not each value of the triplet independently per band. Selecting a level value like 2 causes an overview level that is 1/2 the resolution (in each dimension) of the base layer to be computed. If the file has existing overview levels at a level selected, those levels will be recomputed and rewritten in place. For internal GeoTIFF overviews (or external overviews in GeoTIFF format), note that -clean does not shrink the file. A later run of gdaladdo with overview levels will cause the file to be expanded, rather than reusing the space of the previously deleted overviews. If you just want to change the resampling method on a file that already has overviews computed, you don't need to clean the existing overviews. Some format drivers do not support overviews at all. Many format drivers store overviews in a secondary file with the extension .ovr that is actually in TIFF format. By default, the GeoTIFF driver stores overviews internally to the file operated on (if it is writable), unless the -ro flag is specified. Most drivers also support an alternate overview format using Erdas Imagine format. To trigger this use the USE_RRD=YES configuration option (Example 5). This will place the overviews in an associated .aux file suitable for direct use with Imagine or ArcGIS as well as GDAL applications. (e.g. --config USE_RRD YES) EXTERNAL OVERVIEWS IN GEOTIFF FORMATExternal overviews created in TIFF format may be compressed using the COMPRESS_OVERVIEW configuration option. All compression methods, supported by the GeoTIFF driver, are available here. (e.g. --config COMPRESS_OVERVIEW DEFLATE). The photometric interpretation can be set with the PHOTOMETRIC_OVERVIEW =RGB/YCBCR/... configuration option, and the interleaving with the INTERLEAVE_OVERVIEW =PIXEL/BAND configuration option. Since GDAL 3.6, COMPRESS_OVERVIEW and INTERLEAVE_OVERVIEW are honoured when creating internal overviews of TIFF files. For JPEG compressed external and internal overviews, the JPEG quality can be set with --config JPEG_QUALITY_OVERVIEW value. For WEBP compressed external and internal overviews, the WEBP quality level can be set with --config WEBP_LEVEL_OVERVIEW value. If not set, will default to 75. For WEBP compressed external and internal overviews, the WEBP lossless/lossy switch can be set with --config WEBP_LOSSLESS_OVERVIEW value. If not set, will default to NO (lossy). Added in GDAL 3.6.0 For LERC compressed external and internal overviews, the max error threshold can be set with --config MAX_Z_ERROR_OVERVIEW value. If not set, will default to 0 (lossless). Added in GDAL 3.4.1 For DEFLATE or LERC_DEFLATE compressed external and internal overviews, the compression level can be set with --config ZLEVEL_OVERVIEW value. If not set, will default to 6. Added in GDAL 3.4.1 For ZSTD or LERC_ZSTD compressed external and internal overviews, the compression level can be set with --config ZSTD_LEVEL_OVERVIEW value. If not set, will default to 9. Added in GDAL 3.4.1 For JPEG-XL compressed external and internal overviews, the following settings can be set since GDAL 3.9.0:
For LZW, ZSTD or DEFLATE compressed external overviews, the predictor value can be set with --config PREDICTOR_OVERVIEW 1|2|3. To produce the smallest possible JPEG-In-TIFF overviews, you should use: --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL External overviews can be created in the BigTIFF format by using the BIGTIFF_OVERVIEW configuration option: --config BIGTIFF_OVERVIEW {IF_NEEDED|IF_SAFER|YES|NO}. The default value is IF_SAFER starting with GDAL 2.3.0 (previously was IF_NEEDED). The behavior of this option is exactly the same as the BIGTIFF creation option documented in the GeoTIFF driver documentation.
Sparse GeoTIFF overview files (that is tiles which are omitted if all their pixels are at the nodata value, when there's one, or at 0 otherwise) can be obtained with --config SPARSE_OK_OVERVIEW ON. Added in GDAL 3.4.1 See the documentation of the GTiff -- GeoTIFF File Format driver for further explanations on all those options. SETTING BLOCKSIZE IN GEOTIFF OVERVIEWS--config GDAL_TIFF_OVR_BLOCKSIZE <size> Example: --config GDAL_TIFF_OVR_BLOCKSIZE 256 Default value is 128, or starting with GDAL 3.1, if creating overviews on a tiled GeoTIFF file, the tile size of the full resolution image. Note: without this setting, the file can have the full resolution image with a blocksize different from overviews blocksize.(e.g. full resolution image at blocksize 256, overviews at blocksize 128) NODATA / SOURCE VALIDITY MASK HANDLING DURING RESAMPLINGInvalid values in source pixels, either identified through a nodata value metadata set on the source band, a mask band, an alpha band will not be used during resampling. The details of how it is taken into account depends on the resampling kernel:
MULTITHREADINGAdded in version 3.2. The GDAL_NUM_THREADS configuration option can be set to ALL_CPUS or a integer value to specify the number of threads to use for overview computation. C APIFunctionality of this utility can be done from C with GDALBuildOverviews(). EXAMPLESExample 1: Create overviews, embedded in the supplied TIFF file, with automatic computation of levelsgdaladdo -r average abc.tif Example 2: Create overviews, embedded in the supplied TIFF filegdaladdo -r average abc.tif 2 4 8 16 Example 3: Create an external compressed GeoTIFF overview file from the ERDAS .IMG filegdaladdo -ro --config COMPRESS_OVERVIEW DEFLATE erdas.img 2 4 8 16 Example 4: Create an external JPEG-compressed GeoTIFF overview file from a 3-band RGB datasetIf the dataset is a writable GeoTIFF, you also need to add the -ro option to force the generation of external overview. gdaladdo --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR Example 5: Create Erdas Imagine format overviews for the indicated JPEG filegdaladdo --config USE_RRD YES airphoto.jpg 3 9 27 81 Example 6: Create overviews for a specific subdatasetFor example, one of potentially many raster layers in a GeoPackage (the "filename" parameter must be driver prefix, filename and subdataset name, like e.g. shown by gdalinfo): gdaladdo GPKG:file.gpkg:layer Example 7: Refresh overviews of a VRT fileThis is needed when for sources have been modified after the .vrt.ovr generation: gdalbuildvrt my.vrt tile1.tif tile2.tif # create VRT gdaladdo -r cubic my.vrt # initial overview generation touch tile1.tif # simulate update of one of the source tiles gdaladdo --partial-refresh-from-source-timestamp -r cubic my.vrt # refresh overviews Example 8: Refresh overviews of a TIFF filegdalwarp -overwrite tile1.tif tile2.tif mosaic.tif # create mosaic gdaladdo -r cubic mosaic.tif # initial overview generation touch tile1.tif # simulate update of one of the source tiles gdalwarp tile1.tif mosaic.tif # update mosaic gdaladdo --partial-refresh-from-source-extent tile1.tif -r cubic my.vrt # refresh overviews AUTHORFrank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de> COPYRIGHT1998-2025
|