vrt.mosaic()
Mosaic tiles of any band count on one grid; later sources draw over earlier ones.
Usage
vrt.mosaic(
sources,
*,
bounds=None,
resolution=None,
resampling=Resampling.nearest,
nodata=None,
band_names=None,
color_interp=None
)Parameters
sources: Sequence[str | Path | UPath | VRT]-
Tiles sharing a CRS, band count, dtypes, scales, offsets and NODATA values. A VRT is nested. Band i of the mosaic reads band i of every tile.
bounds: rasterio.coords.BoundingBox | tuple[float, float, float, float] | None = None-
Extent as
(left, bottom, right, top), a whole number of output pixels; its top-left corner anchors the grid. Defaults to the union of the tiles. resolution: ‘finest’ = "finest"-
Output pixel size.
Nonerequires one common pixel size and every tile on one grid;"finest"takes the smallest pixel size per axis;(x, y)sets it. Withoutbounds, the grid runs through the origin of the first tile of that pixel size, or else the union’s top-left corner, and covers every tile. resampling: Resampling = Resampling.nearest-
Resampling for tiles not on the output grid, which are placed exactly rather than snapped to it and fill only the output pixels whose centre they contain. One of nearest, bilinear, cubic, cubic_spline, lanczos, average, rms, mode or gauss.
nodata: float | None = None-
NODATA of every band, replacing the first tile’s. Tiles keep their own NODATA pixels transparent; tiles without one treat
nodataas theirs. band_names: Sequence[str] | None = None-
Description of each band, replacing the first tile’s.
color_interp: Sequence[ColorInterp] | None = None- Colour interpretation of each band, replacing the first tile’s.
Returns
VRT- A VRT with the first tile’s band descriptions, colour interpretation and NODATA, unless overridden.
Raises
ValueError-
If sources is empty,
nodatadoes not fit in a band’s dtype, the tiles are incompatible, off the pixel grid (withresolution=None), rotated, south-up or with a colour table,boundsis not whole pixels,resolutionis not positive,resamplingis not supported, orband_namesorcolor_interpdo not match the band count.