A virtual raster is a special type of raster whose pixel values are created upon request during data processing or visualization. Its memory footprint includes a reference to a source raster along with details of how the source pixel values will be modified in order to create new pixels. Virtual rasters save time and disk space by computing only the pixels you really need instead of the entire image. They can be used as input to other operations without any intermediate steps and without having to keep track of file references. An example is ENVISubsetRaster, which creates a virtual raster that is a spatial and/or spectral subset of the original data.
Here are some tips for working with virtual rasters:
- They inherit the same methods and properties as ENVIRaster.
- To share results with others, use the Export method to save the result to a file on disk.
- Virtual rasters will not have a URI or AUXILIARY_URI property because they have not been written to disk.
- Although the PYRAMID_EXISTS property is 1 (true) for virtual rasters, pyramids are virtual and are only used when you display the virtual raster in a view (or call the CreatePyramid method).
- The READ_ONLY property is 1 (true), which means that you cannot subsequently change data using the SetTile, SetData, Save, or WriteMetadata methods.
Virtual Rasters and ENVITasks
Most virtual rasters are also available as ENVITasks. An example is ENVIMaskRaster (virtual raster) and the MaskRaster task. Both of these produce new rasters with a mask applied. In general, we recommend using ENVITasks because:
- They were designed for beginning API users.
- They save intermediate processing results to disk (although you can disable this when setting the task output parameters). Saving results to disk can be faster than saving the results in memory.
- They are the primary medium for using ENVI analytics in command-line environments.
Virtual rasters can process data on-demand to yield a new result that does not need to be saved to disk. This allows you to view and access a result from a specific area of a raster without waiting for the entire result to write to disk. With virtual rasters, you can experiment with your data to determine the best parameters and options before exporting it to disk. As with ENVITasks, they can be chained together to create workflows. However, a disadvantage is that they can use a significant amount of RAM because processing results are stored in memory. In some cases, virtual raster processing is significantly slower compared to their ENVITask equivalents. An example is ENVIMosaicRaster.
List of Virtual Rasters