diff --git a/pysegcnn/core/utils.py b/pysegcnn/core/utils.py index 570aeef129f12f37e55d40f15655879fea8362d1..1b62a1c70f4b652ee39376a87545c7adca8b6d18 100644 --- a/pysegcnn/core/utils.py +++ b/pysegcnn/core/utils.py @@ -2451,3 +2451,18 @@ def gdb2shp(src_ds, feature=''): # call the osgeo ogr2ogr system utility subprocess.run('ogr2ogr -f "ESRI Shapefile" {} {} {}'.format( src_ds, src_ds.parent, feature)) + + +def merge_tifs(trg_ds, tifs): + """Mosaic a set of images. + + Parameters + ---------- + trg_ds : `str` or :py:class:`pathlib.Path` + Path to the output GeoTiff file. + tifs : `list` [`str` or :py:class:`pathlib.Path`] + List of paths to the GeoTiffs to mosaic. + + """ + LOGGER.info('Creating mosaic: {}'.format(trg_ds)) + gdal.Warp(str(trg_ds), [str(tif) for tif in tifs])