Forrest logo
back to the gdalbuildvrt tool

gdalbuildvrt:tldr:3c760

gdalbuildvrt: Make a virtual mosaic from all TIFF files contained in a directory.
$ gdalbuildvrt ${path-to-output-vrt} ${path-to-input_directory-*-tif}
try on your machine

The command "gdalbuildvrt" is used in the GDAL (Geospatial Data Abstraction Library) software to create a virtual dataset (VRT) file. A VRT file is a metadata file that references multiple input raster files without actually merging them physically.

This specific command is using the "${path-to-output-vrt}" and "${path-to-input_directory-*-tif}" placeholders to specify the paths of the output VRT file and the input raster files. Here's how it works:

  • "${path-to-output-vrt}": This is the path where the VRT file will be created or overwritten. You need to specify the desired location and name of the output VRT file. For example, "/path/to/output.vrt".

  • "${path-to-input_directory--tif}": This placeholder references the input raster files with a wildcard pattern. In this case, it indicates that input files are located in a specific directory and have a filename pattern of "anyname.tif". The asterisk () is a wildcard character that matches any text. This allows the command to read and process multiple input files that match the pattern. For example, if the input raster files are located in "/path/to/input/" directory, you can use "/path/to/input/*-tif".

Putting it all together, the command would look like:

gdalbuildvrt /path/to/output.vrt /path/to/input/*-tif

This command will take all the input raster files with filenames ending with "-tif" in the specified input directory and create a VRT file named "output.vrt" in the specified output path. The created VRT file will act as a virtual mosaic that references all the input raster files.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gdalbuildvrt tool