I would like to create a virtual raster from an .img file that has associated .ige, .rde, .rrd, and .xml files. I am doing this to enable virtual I/O so I want an "exact copy" of the original raster.

I am just calling this from the command line:

gdalbuildvrt file.vrt file.img

This creates a VRT but the attribute table is stripped; instead of categorical data I now have continuous values. How can I fix this?

  • Open the .vrt file with text editor. Does it contain element GDALRasterAttributeTable gdal.org/drivers/raster/vrt.html? – user30184 Nov 12 '20 at 19:58
  • No it doesn't. It has a single VRTRasterBand with a ColorTable but not an attribute table – qdread Nov 12 '20 at 20:38
  • 1
    It seems that there is some RAT support in vrt github.com/OSGeo/gdal/pull/743 but RATs are rather uncommon. It might be better to ask directly from gdal-dev mailing list. – user30184 Nov 12 '20 at 21:23
  • Do you get a different result if you use gdal_translate -of VRT file.img file.vrt instead of gdalbuildvrt? – user2856 Nov 13 '20 at 1:01
  • No I tried gdal_translate as well and got the same result as with gdalbuildvrt. – qdread Nov 13 '20 at 2:39

Your Answer

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

Browse other questions tagged or ask your own question.