0

I'm working with a lot of rasters (dozens of thousands) and would like to store them for a while. They will be used intermittently, but never all at once! The size of VRT (~2 kb) is such a positive for me, because I can store a year's worth of rasters with less than a GB for cost, whereas before I was dealing with upwards of 50 GB when using TIF.

I'm just worried that maybe I don't fully understand the VRT file type. I've tried to look at documentation and don't see anything wrong with doing this.

Do you think this is OK?

4
  • 1
    VRT itself is not a raster but it gives instructions about how to read the real image file. I suppose that you know that and if you take care that you save the original data files together with the .vrt files there is nothing wrong with your approach.
    – user30184
    Commented Apr 17, 2019 at 21:02
  • Thanks for the response! I know the VRT itself is not a raster, but can be easily converted to one using gdal_translate. Based on your response, I have to keep the original .tif alongside the .vrt in order for the .vrt to be functional? Sorry, just trying to make sure I understand.
    – JWB
    Commented Apr 18, 2019 at 5:04
  • 2
    Yes, you have to keep the original .tif available. VRT is described in gdal.org/gdal_vrttut.html and you can read there how it works <SourceFilename relativeToVRT="1">utm.tif</SourceFilename>.
    – user30184
    Commented Apr 18, 2019 at 6:14
  • @user30184 - please make this an answer
    – Ian Turton
    Commented Apr 18, 2019 at 6:59

1 Answer 1

6

No, this does not make sense.

VRT is Virtual Raster Type, not a real raster. There is no data in a VRT, the data is just referenced in an XML file. You have to keep the original data.

<SourceFilename relativeToVRT="1">utm.tif</SourceFilename>

See here for documentation.

VRT's make sense for e.g. mosaicing, merging, cutting, converting files when you don't want to store the result but do it on the fly; or have the VRT as intermediate product to a further converstion.

a virtual dataset [...] composed from other [...] datasets with repositioning, and algorithms potentially applied as well as various kinds of metadata altered or added.

You can create VRTs of your TIFs, but that is just extra space.

To reduce file size, you might use compression on the files if they are not already compressed. Lossless compression (Deflate, LZW, Packbits) will reduce the size by a fair amount, lossy compression (JPEG) if possible will reduce by a huge amount.

5
  • It may make sense to save the .vrt files if the original images must be saved in any case, and if .vrt adds something non-trivial to the original data that normally requires writing out a new physical image file. For example derived bands and pansharpened VRT in gdal.org/gdal_vrttut.html are good examples about that.
    – user30184
    Commented Apr 18, 2019 at 7:24
  • 1
    that is what I tried to say in the second paragraph "VRT's make sense for ..."
    – pLumo
    Commented Apr 18, 2019 at 7:34
  • One other use is sparse raster. That is several non contiguous rasters that can be used as a whole without having to store a full raster encompassing them
    – Billy34
    Commented Apr 18, 2019 at 7:54
  • This works as long as you still work in the same CRS. If your project is in another CRS, reprojecting the source data of the VRT on-the-fly will cost a reasonable time during project work, compared to a ready-reprojected new TIF file. Same goes for low-zoom overviews if your source data does not have them.
    – AndreJ
    Commented Apr 19, 2019 at 15:05
  • Thank you so much - I had gotten lost in the VRT documentation. I will just stick with compression!
    – JWB
    Commented Apr 22, 2019 at 4:59

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.