I am doing mosaicing of 14 raster images (.img format) to completely cover a province.see original spatial location of separately opened tiles(). Mosiac operation is completed but 4 tiles are mosiaced on wrong spatial location. whereas other 10 tiles are mosiaced accurately (). when i am opening separate files all files are getting opened at their origina spatial location. please help me to resolve this issue. I am using this code for mosaicing of 14 raster images.
import rasterio from rasterio.merge import merge from rasterio.plot import show import glob import os dirpath = r"path" outpath = r"outpath\Mosiac.tif" search_criteria = "*.img" q = os.path.join(dirpath, search_criteria) print (q) img_fps = glob.glob(q) img_fps src_files_to_mosiac =  for sim in img_fps: src = rasterio.open(sim) src_files_to_mosiac.append(src) src_files_to_mosiac mos, out_trans = merge(src_files_to_mosiac) show(mos, cmap='terrain') with rasterio.open(outpath,"w", driver ='Gtiff',count=3, height= mos.shape, width= mos.shape, transform= out_trans, crs= src.crs, dtype= src.dtypes) as dest: dest.write(mos)