## vrt.mosaic()


Mosaic tiles of any band count on one grid; later sources draw over earlier ones.


Usage

``` python
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](vrt.VRT.md#freezebase.vrt.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. `None` requires one common pixel size and every tile on one grid; `"finest"` takes the smallest pixel size per axis; `(x, y)` sets it. Without `bounds`, 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 `nodata` as 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](vrt.VRT.md#freezebase.vrt.VRT.sources) is empty, `nodata` does not fit in a band's dtype, the tiles are incompatible, off the pixel grid (with `resolution=None`), rotated, south-up or with a colour table, `bounds` is not whole pixels, `resolution` is not positive, `resampling` is not supported, or `band_names` or `color_interp` do not match the band count.
