0

I recently discovered VRT format and I wonder if it could be suited to my problem.

I have a program A that expects as an input a N-bands Geotiff (N >> 1000). I have presently k = 200 rasters that I assembled into a VRT and converted to a 200-bands Geotiff.

Can I use the VRT format to mimic the 1000 bands Geotiff that A expects using actually only 200 bands (avoiding the creation/upload of a quite heavy file on the cloud)?

Would it be possible to pass it to the said program A without modifying A code (that is, is VRT a "subtype" of Geotiff format in the C api?

1 Answer 1

1

I do not know "program A" but certainly you can create more bands with VRT. File "test.tif" is a 3-band image.

gdal_translate -of VRT -b 1 -b 1 -b 1 -b 1 -b 1 test.tif 5band.vrt

gdalinfo 5band.vrt
Driver: VRT/Virtual Raster
Files: 5band.vrt
       test.tif
Size is 12000, 12000
Coordinate System is:
...
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
  Overviews: 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375, 188x188
Band 2 Block=256x256 Type=Byte, ColorInterp=Red
  Overviews: 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375, 188x188
Band 3 Block=256x256 Type=Byte, ColorInterp=Red
  Overviews: 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375, 188x188
Band 4 Block=256x256 Type=Byte, ColorInterp=Red
  Overviews: 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375, 188x188
Band 5 Block=256x256 Type=Byte, ColorInterp=Red
  Overviews: 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375, 188x188
3
  • Nice thank you! And so the "size" of the 5band vrt is minimal, right? By this, I mean there is no data duplication? Regarding program A, it is a C++ program that uses the GDAL API and stores a pointer on a GDALDataset. I assume it should somehow handle a VRT ?
    – WaterFox
    Commented Jan 20, 2022 at 17:31
  • 1
    File 5band.vrt is 3854 bytes, it is just XML text. The source image test.tif must be available but it is not touched or multiplied. As you can see, GDAL, including gdalinfo, can read VRT.
    – user30184
    Commented Jan 20, 2022 at 17:39
  • Wonderful! Thank you !
    – WaterFox
    Commented Jan 20, 2022 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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