VRT files, ending in an .vrt extension, contain human-readable text in an XML language that contain command inputs for the GDAL / OGR package (henceforth abbreviated GDAL). VRT files usually tell GDAL what to do with data from files in various formats that GDAL understands, but they can contain all sorts of other commands as well.
When we try to import or to link a VRT file, Manifold simply passes the VRT file to GDAL and imports or links whatever result GDAL provides.
VRT files are often described as GDAL virtual format files, because the result of processing a VRT with GDAL is what may appear to be a single raster image, a mosaic of many other images, instead of the many GeoTIFF files which the VRT cites. But in reality the result is not virtual data but real pixel data pulled from existing, totally non-virtual files. It is only the arrangement of the data that is created on the fly.
In a Windows folder we have three files:
IND_cov.grd
IND_cov.gri
IND_cov.vrt
The .vrt file contains the following text:
<VRTDataset rasterXSize="3528" rasterYSize="3468">
<GeoTransform>68.1, 0.008333333, 0, 35.6, 0, -0.008333333</GeoTransform>
<SRS>+proj=longlat +ellps=WGS84</SRS>
<VRTRasterBand dataType="Int16" band="1" subClass="VRTRawRasterBand">
<Description>IND_cov</Description>
<SourceFilename relativetoVRT="1">IND_cov.gri</SourceFilename>
<ImageOffset>0</ImageOffset>
<PixelOffset>2</PixelOffset>
<LineOffset>7056</LineOffset>
<ByteOrder>LSB</ByteOrder>
<NoDataValue>-9999</NoDataValue>
<Offset>0</Offset>
<Scale>1</Scale>
</VRTRasterBand>
</VRTDataset>
The text above tells GDAL to take data from the IND_cov.gri file and to process it in a way that results in a raster image. Note that the way the VRT file refers to the source image the IND_cov.gri file must be located in the same folder as the VRT file. If we send the VRT file to a colleague but we do not send the IND_cov.gri file, the VRT file will not work. If we move either the VRT file or the IND_cov.gri file to a different folder, the VRT file will not work.
If we drag and drop the IND_cov.vrt file into the Project pane, the result is a new image.
We can create a map using the new image as a layer to see the result.
Importing the VRT file imported the image stored in the IND_cov.gri file, using GDAL to read the file and to process the image in accordance with the parameters specified in the VRT file.
This particular file is a single-channel raster, where the single value in each pixel is a code for land use. Using the Style pane to apply typical land use color palette and using blue color for the pixels that represent water, we can create a result like the above.
Perhaps the most common use of VRT files is to create mosaics of many files. In such cases what will be imported into Manifold will be a single image, and when linking, will appear to be a single image. Once imported, the image has nothing to do with GDAL and can be used as the real image that it is. If linked, Manifold will treat the results as a single image, subject to the limitations of what ends being a read-only image passed along by GDAL. if we copy the image and then paste it into the local part of the project that will create a single, fully read/write image.
Some VRT files intended to create a mosaic reference hundreds of image files. The idea is to use the VRT file to feed GDAL a set of commands for creating a mosaic, and to then sample only that part of the image that appears in view when zoomed in. That is very risky business, because it depends upon the starting zoom level being something that does not stretch our patience for GDAL to import.
When using mosaics, Manifold simply imports or generates a cache for the entire mosaic. In a case like the French IGN agency's VRT mosaic for all orthophotography for all of France, although Manifold can easily handle the very large image that results, it takes GDAL seemingly forever to process all the files involved. In such cases it is usually much quicker to simply drag and drop all the images desired into the Manifold project (which can handle hundreds of them) and to then merge them together using the Edit - Merge - Merge Images command.
VRTs with errors - It is extremely common to encounter VRT files that have programming errors in them. Such VRT files will not work correctly. If a VRT does not work, that is an issue with either the VRT or with the GDAL installation being used. Manifold does not touch the VRT, but instead relies on GDAL to do all processing of the VRT.
GDAL is not Manifold - When connecting to GDB using GDAL/OGR we must be aware we are no longer using Manifold code but instead are using GDAL code. GDAL has earned a good reputation. It is a tremendous advantage to use GDAL's very broad reach of modules from Manifold to connect to many niche or nearly-extinct formats, and GDAL does a great job at that. However, GDAL's code in general is not as bulletproof as the Radian technology used in Manifold. Connections using GDAL, like VRT files, fall outside of Manifold's reputation for never crashing.
Example: Import ERDAS GIS with GDAL and Assign Coordinate System - A multistep example that covers import of an unwieldy format using GDAL, followed by use of Assign Initial Coordinate System and Repair Initial Coordinate System to deal quickly with real-life complications.
Example: Connect to an ESRI GDB usng GDAL/OGR - Instead of using Manifold's built-in ability to connect to modern ESRI GDB file geodatabases, use the Manifold GDAL/OGR dataport to take advantage of the GDAL library's ability to connect to deprecated GDB formats.