In GDAL, I have seen the sample line:

gdalwarp $(list_of_tiffs) merged.tiff

I would like to merge images to create a mosaic, but can't use gdal_merge (need an exe file), e.g to merge C:\Temp\image1.jpg with C:\Temp\image2.jpg. Can someone give me an example for the command above?


The vrt way is the better way, but as an answer to what you asked:

From the gdalwarp manual page http://www.gdal.org/gdalwarp.html you can read the last two parameters srcfile* dstfile

and from the parameter exlanations:

srcfile: The source file name(s). dstfile: The destination file name.

So, the syntax is

gdalwarp -of GTiff -s_srs epsg:4326 -t_srs epsg:3857 input_1.tif input_2.tif input_3.tif output.tif

If you want just a mosaic in the source projection and into GeoTIFF format which is the default use can do it with a short command

gdalwarp input_1.tif input_2.tif input_3.tif output.tif


You can do it in two steps. Note that in most cases you don't need to create a new file if you use a vrt.

gdalbuildvrt output.vrt C:\Temp\image1.jpg C:\Temp\image2.jpg

but if you REALLY need a unique file, then you can then translate it (or warp it if you also need to change the srs of the dataset)

gdal_translate output.vrt output.tif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.