merge_vrt(paths: list, merged_path: str | CloudPath | Path, abs_path: bool = False, **kwargs) None[source]#

Merge rasters as a VRT. Uses gdalbuildvrt.

See here:

Creates VRT with relative paths !

This function handles files of different projection by create intermediate VRT used for warping. All VRTs will be written with relative paths.

>>> paths_utm32630 = ["path/to/raster1.tif", "path/to/raster2.tif", "path/to/raster3.tif"]
>>> paths_utm32631 = ["path/to/raster4.tif", "path/to/raster5.tif"]

>>> mosaic_32630 = "path/to/mosaic_32630.vrt"
>>> mosaic_32631 = "path/to/mosaic_32631.vrt"

>>> # Create mosaic, one by CRS !
>>> merge_vrt(paths_utm32630, mosaic_32630)
>>> merge_vrt(paths_utm32631, mosaic_32631, {"-srcnodata":255, "-vrtnodata":0})
  • paths (list) – Path of the rasters to be merged with the same CRS)

  • merged_path (AnyPathStrType) – Path to the merged raster

  • abs_path (bool) – VRT with absolute paths. If not, VRT with relative paths (default)

  • kwargs – Other gdlabuildvrt arguments