LinuxCommandLibrary

gdalbuildvrt

Create virtual raster from raster list

TLDR

Make a virtual mosaic from all TIFF files contained in a directory

$ gdalbuildvrt [path/to/output.vrt] [path/to/input_directory/*.tif]
copy

Make a virtual mosaic from files whose name is specified in a text file
$ gdalbuildvrt -input_file_list [path/to/list.txt] [path/to/output.vrt]
copy

Make an RGB virtual mosaic from 3 single-band input files
$ gdalbuildvrt -separate [path/to/rgb.vrt] [path/to/red.tif] [path/to/green.tif] [path/to/blue.tif]
copy

Make a virtual mosaic with blue background color (RGB: 0 0 255)
$ gdalbuildvrt -hidenodata -vrtnodata "[0 0 255]" [path/to/output.vrt] [path/to/input_directory/*.tif]
copy

SYNOPSIS

gdalbuildvrt [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-te_srs srs_defn] [-s_srs srs_defn] [-a_srs srs_defn] [-r {nearest,bilinear,cubic,cubicspline,average,mode}] [-resolution {lowest,highest,average,user}] [-b band_list] [-separate] [-sd subdataset] [-addalpha] [-hidenodata] [-srcnodata "value [value...]"] [-vrtnodata value] [-oo NAME=VALUE] [-pct] [-q] [-overwrite] [-update] [-addtoband] [input_files...] output.vrt

PARAMETERS

-te xmin ymin xmax ymax
    Set target georeferenced extents

-tr xres yres
    Set target resolution in georeferenced units

-tap
    Use pseudo-aligned target resolution

-te_srs srs_defn
    SRS for target extent coordinates

-s_srs srs_defn
    Source SRS (override source file SRS)

-a_srs srs_defn
    Assign SRS to output VRT

-r {resampling_method}
    Resampling method: nearest, bilinear, cubic, etc.

-resolution {lowest,highest,average,user}
    Resolution selection strategy

-b band
    Select input bands (repeatable)

-separate
    Treat inputs as separate bands

-addalpha
    Add alpha band to output

-hidenodata
    Propagate nodata values internally

-srcnodata value
    Nodata values for input datasets

-vrtnodata value
    Nodata value for VRT

-q
    Quiet mode, suppress progress

-overwrite
    Overwrite existing VRT file

-update
    Append to existing VRT

DESCRIPTION

gdalbuildvrt is a GDAL utility that creates a Virtual Raster Dataset (VRT) file, an XML-based format representing a mosaic or stack of input raster datasets without physically copying pixel data. This enables efficient handling of large raster collections by accessing source files on demand.

It supports mosaicking multiple files into a single virtual image with automatic reprojection, resampling, and nodata handling. Key benefits include reduced storage needs, support for different projections via -s_srs and -a_srs, and options for pixel functions or color table merging. Ideal for geospatial workflows like creating seamless orthoimages or multi-band composites.

Usage involves specifying input rasters and an output VRT file. Options allow control over resolution matching (lowest, highest, average), target extent, and band selection. Ground control points (GCPs) can be added for georeferencing. Output VRTs are readable by GDAL tools like gdal_translate or QGIS.

CAVEATS

VRT performance depends on source file access speed; does not handle very large mosaics efficiently without overview pyramids. Source files must remain accessible. Limited support for non-rectilinear projections.

VRT TYPES

Supports VRTWarpedDataset for reprojection and VRTRasterBand for complex pixel functions.

GCP SUPPORT

Use -gcp pixel line easting northing [elev] (repeatable) to add ground control points for georeferencing.

HISTORY

Introduced in GDAL 1.6.0 (2007) as part of core raster utilities. Evolved with GDAL releases to support advanced resampling, multi-dimensional VRTs (GDAL 3.1+), and NITF/RPFTOC formats. Widely used in open-source GIS since GDAL 2.x stabilization.

SEE ALSO

gdal_translate(1), gdalwarp(1), gdal_merge.py(1)

Copied to clipboard