raster.merge_tiffs()

Merge multiple GeoTIFF files into a single file.

Usage

Source

raster.merge_tiffs(
    src_files, dst_file, *, method="first", mem_limit_mb=10000, profile=None
)

Uses rasterio.merge.merge() to combine overlapping rasters. Band names are copied from the first source file.

Parameters

src_files: Sequence[str | Path | UPath]

Sequence of source GeoTIFF files to merge. Must all have same CRS.

dst_file: str | Path | UPath

Path to output merged GeoTIFF.

method: str = "first"
Method for handling overlapping pixels. Options:
  • “first”: Use value from first raster in list
  • “last”: Use value from last raster in list
  • “min”: Use minimum value
  • “max”: Use maximum value
mem_limit_mb: int = 10000

Memory limit in megabytes for merge operation. Controls how much data is read into memory at once. Default is 10GB.

profile: dict[str, Any] or None = None
Custom rasterio profile settings. If None, uses deflate compression with 512x512 tiling.

Raises

ValueError

If src_files is empty, or the files do not all share a CRS.

FileNotFoundError

If any source file does not exist.

RuntimeError
If merge operation fails.