merge_gtiff

Contents

merge_gtiff#

merge_gtiff(paths: list, merged_path: str | CloudPath | Path, **kwargs) None[source]#

Merge rasters as a GeoTiff.

This function handles files of different projection by creating intermediate VRT used for warping.

Using rasterio.merge with default arguments behind the hood so you can provide any valid argument into the kwargs. For example, to modify the merging method, you can pass method="max"

Parameters:
  • paths (list) – Path of the rasters to be merged with the same CRS)

  • merged_path (AnyPathStrType) – Path to the merged raster

  • kwargs – Other rasterio.merge arguments More info here

Example

>>> 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.tif"
>>> mosaic_32631 = "path/to/mosaic_32631.tif"
>>>
>>> # Create mosaic, one by CRS !
>>> merge_gtiff(paths_utm32630, mosaic_32630)
>>> merge_gtiff(paths_utm32631, mosaic_32631)