This function constructs an ENVIRaster from a stack of source rasters with the same spatial dimensions. Metaspectral rasters often combine bands from different rasters into a single file.
- The input rasters must have the same number of rows and columns.
- The input rasters can have different pixel sizes.
- The input rasters do not need to be georeferenced, but you can georeference the resulting metaspectral raster using the SPATIALREF keyword.
- The input rasters can be of different interleave types, but the resulting metaspectral raster will be BSQ.
- The input rasters can be of different data types, but the resulting metaspectral raster will be cast to the highest data type out of all the rasters. Complex and non-complex data cannot be mixed.
- Use ENVILayerStackRaster to create a georeferenced layer stack. A layer stack is similar to a metaspectral raster except that the source rasters are regridded to a common spatial grid.
- See Working with Metaspectral Datasets in the ENVI API for guidelines on using Landsat and ASTER imagery.
This task is different than ENVILayerStackRaster, where the input rasters can have different numbers of rows and columns and they will be reprojected and regridded to a common spatial grid.
The result is a virtual raster, which has some additional considerations with regard to methods and properties. See Virtual Rasters for more information, including how they differ from ENVITasks.
The equivalent task is BuildBandStack.
This example creates a raster that includes seven multispectral bands from the Landsat-8 OLI sensor and two thermal bands from its TIRS sensor. Update the file location with your own directory and data file. After running this example, open the Data Manager to see the full band list.
e = ENVI()
File = 'LC80410302013229LGN00_MTL.txt'
Raster = e.OpenRaster(File)
OLIBands = Raster
TIRBands = Raster
MSRaster = ENVIMetaspectralRaster([OLIBands,TIRBands])
DataColl = e.Data
View = e.GetView()
Layer = View.CreateLayer(MSRaster)
See More Examples for other common uses for metaspectral rasters.
Result = ENVIMetaspectralRaster(Input_Rasters [, Keywords=value])
This routine returns a reference to an ENVIRaster.
Specify an array of input ENVIRasters.
This virtual raster inherits methods and properties from ENVIRaster; however the following methods will override the ENVIRaster methods:
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
Specify a string that identifies the raster.
Set this keyword to an ENVIStandardRasterSpatialRef, ENVIPseudoRasterSpatialRef, or ENVIRPCRasterSpatialRef object to be used by the output raster. If this keyword is not specified, then the first valid SPATIALREF property found in the Input_Rasters array will be used.
Combine bands from different rasters
This example creates one raster that consists of Band 2 from a 1985 Landsat TM image and Band 2 from a 2005 TM image. The result is called a band stack. Both source images have the same number of rows and columns; they are also in the same coordinate system and have the same pixel size (30 m).
The example uses sample images that are available from our ENVI Tutorials web page. Click the Landsat Case Studies link to download the .zip file to your machine, then unzip the files. Update the file location with your own directory.
e = ENVI()
File1 = 'LasVegasTM5May1985.dat'
Raster1 = e.OpenRaster(File1)
File2 = 'LasVegasTM5May2005.dat'
Raster2 = e.OpenRaster(File2)
RedRaster1 = ENVISubsetRaster(Raster1, BANDS=1)
RedRaster2 = ENVISubsetRaster(Raster2, BANDS=1)
BandStack = ENVIMetaspectralRaster([RedRaster1, RedRaster2], $
View = e.GetView()
Layer1 = View.CreateLayer(BandStack, BANDS=)
View2 = e.CreateView()
Layer2 = View2.CreateLayer(BandStack, BANDS=)
Documented the dehydrated form of this virtual raster
Removed layer stacking code example; use ENVILayerStackRaster now for layer stacking.
Added Dehydrate and Hydrate methods; added NAME keyword
ENVIRaster, BuildBandStack Task, ENVISpatialGridRaster, ENVILayerStackRaster