I'm trying to create a mosaic raster from two rasters. With rasterio
works well but gdal_merge.py
subprocess calling doesn`t work for me.
My Error is:
OSError: [WinError 193] %1 is not a valid Win32 application
import numpy as np
import matplotlib.pyplot as plt
import subprocess, glob
from osgeo import gdal
files_to_mosaic = glob.glob('C:/Users/DanielKovacs/Documents/GranCanaria/mosaic_L2A_T28RDS_A025431_20200505T115222_2020- 05-05_con/*_B04.tif')
files_to_mosaic
files_string = " ".join(files_to_mosaic)
print(files_string)
command = "gdal_merge.py -o mosaic2.tif -of gtiff " + files_string
output = subprocess.run(command)
output
Best Answer
You can probably do this with
gdal.Warp
in Python directly:There's loads of other options you can add on to this.