gdal.build_vrt

Build a GDAL Virtual Raster (VRT) from a collection of rasters.

  • Kind: standard
  • Network: no
  • Wraps: gdalbuildvrt

Inputs🔗

NameTypeDescription
sourcescollection of file (GeoTIFF)Collection of input rasters to assemble into the VRT.
resolutionstringOne of highest, lowest, average, user (default highest).
separatebooleanStack sources as separate bands instead of a mosaic. Default false.

Outputs🔗

NameTypeDescription
vrtfile (VRT)Virtual raster over the input collection, packaged with copies of its sources under sources/.

Output layout🔗

A VRT is an XML file of references to other rasters, and the runtime moves the file: into outputs/<name>/, then into a downstream block's inputs/<name>/, usually on another machine. GDAL records those references relative to where the VRT was written, so a bare VRT does not survive the trip. This block therefore publishes the VRT with copies of its sources beside it:

outputs/vrt/
  mosaic.vrt
  sources/
    0000_tile_a.tif
    0001_tile_b.tif

Every reference in mosaic.vrt points into sources/, so the bundle reads identically wherever it is staged. A downstream raster input receives mosaic.vrt as its file and the sources/ directory travels with it. The source bytes move once, at upload; the VRT itself stays lazy for whoever reads it. References the runtime does not move (/vsis3/, /vsicurl/) are left as written.

One limit: a bundle gathered into a kind: reduce block as one member of its collection does not survive, because the gather renames every top-level entry with the sibling's index and the VRT's references no longer match.

To broadcast the result cheaply — into a map over thousands of regions, say — follow it with platform.normalize_vrt, which rewrites the bundle to a few kilobytes of object references that read their sources lazily wherever the runtime stages them.