sertit.rasters_rio.merge_vrt¶
- merge_vrt(crs_paths: list, crs_merged_path: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], **kwargs) None [source]¶
Merge rasters as a VRT. Uses gdalbuildvrt.
See here: https://gdal.org/programs/gdalbuildvrt.html
Creates VRT with relative paths !
Warning
They should have the same CRS otherwise the mosaic will be false !
>>> 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})