December 11, 2018
Mosaicking of remotely sensed datasets are essential requirement when our area of interest covering two or more of image footprints.
As mentioned in my previous post, GDAL VRT can help us to save lots of space, and very helpful to speed-up your processing work-flow.
GDAL is like our swiss army knife, small and versatile. so here are tips on how to use DAL VRT to help you in your projects either it big or small.
If your area of interest covering two satellite’s scene, you can run gdalbuildvrt from command line.
gdalbuildvrt mosaic.vrt scene1.tif scene2.tif
In case you have more images to mosaic, you can list all the images into *.txt file.
gdalbuildvrt -input_file_list image_scene_list.txt mosaic.vrt
It is possible to create RGB image, by using different combination of bands. Let say we have landsat 7 dataset which have Band1, Band2, Band3, Band4, etc… in our dataset and we need to merge them to create a new composite image. Remember the combination will be Red, Blue, and Green. So, when we run gdalbuildvrt it will be like this
gdalbuildvrt RGB_Image.vrt Band3.tif Band2.tif Band1.tif
To create composite images, we add -separate into the command line.
gdalbuildvrt -separate Composite_image.vrt Band1.tif Band2.tif band3.tif Band4.tif Band5.tif
or, just make a list of your images into *.txt file
gdalbuildvrt -separate -input_file_list image_scene_list.txt Composite_image.vrt
If you want to learn more about gdalbuildvrt you can visit here and here.