>  Docs Center  >  ENVI API  >  ENVI Classic Processing  >  ENVI_LAYER_STACKING_DOIT



This routine is obsolete and has been replaced by ENVILayerStackRaster.

Use this procedure to build a new multi-band file from georeferenced images of various pixel sizes, extents, and projections. The input bands will be resampled and reprojected to a common output projection and pixel size. The output file will contain only data based on the map extent of the input images. You can select either an inclusive (encompass all the files) or exclusive (encompass file overlap) output image.


ENVI_DOIT, 'ENVI_LAYER_STACKING_DOIT', DIMS=array [, /EXCLUSIVE], FID=file ID [, /IN_MEMORY] [, INTERP={0 | 1 | 2}] [, OUT_BNAME=string array] [, OUT_DT={1 | 2 | 3 | 4 | 5 | 6 | 9 | 12 | 13 | 14 | 15}], OUT_NAME=string, OUT_PROJ=structure, OUT_PS=array, POS=array, R_FID=variable



The “dimensions” keyword is a five-element array of long integers that defines the spatial subset (of a file or array) to use for processing. Nearly every time you specify the keyword FID, you must also specify the spatial subset of the corresponding file (even if the entire file, with no spatial subsetting, is to be processed).

  • DIMS[0]: A pointer to an open ROI; use only in cases where ROIs define the spatial subset. Otherwise, set to -1L.
  • DIMS[1]: The starting sample number. The first x pixel is 0.
  • DIMS[2]: The ending sample number
  • DIMS[3]: The starting line number. The first y pixel is 0.
  • DIMS[4]: The ending line number

To process an entire file (with no spatial subsetting), define DIMS as shown in the following code example. This example assumes you have already opened a file using ENVI_SELECT or ENVI_PICKFILE:

  envi_file_query, fid, dims=dims

EXCLUSIVE (optional)

Set this keyword to specify an exclusive range (encompassing file overlap) based on the map extent of each input layer. The default is an inclusive range, encompassing all files. The spatial size of a layer-stacked image generated with the EXCLUSIVE keyword set will always be equal to or smaller than the inclusive result.


Use this keyword to specify the file IDs for the input files. FID is an array of input file IDs with one file ID for each input file (layer). This value is returned from the keyword R_FID in the ENVI_OPEN_FILE procedure. FID is a long integer with a value greater than 0. An invalid file ID has a value of -1. The number of elements of POS and FID correspond to the number of input files to stack together, one entry for each file.

IN_MEMORY (optional)

Set this keyword to specify that output should be stored in memory. If you do not set IN_MEMORY, output will be stored on disk and you must specify OUT_NAME (see below).

INTERP (optional)

Set this keyword to one of the following values to specify the resampling method.

  • 0: Nearest neighbor
  • 1: Bilinear
  • 2: Cubic convolution

The default method is nearest neighbor.

OUT_BNAME (optional)

Use this keyword to specify a string array of output band names.


This keyword indicates the IDL data type of the output data. Set the keyword to one of the following integer values:

  • 1: Byte (8 bits)
  • 2: Integer (16 bits)
  • 3: Long integer (32 bits)
  • 4: Floating-point (32 bits)
  • 5: Double-precision floating-point (64 bits)
  • 6: Complex (2x32 bits)
  • 9: Double-precision complex (2x64 bits)
  • 12: Unsigned integer (16 bits)
  • 13: Unsigned long integer (32 bits)
  • 14: Long 64-bit integer
  • 15: Unsigned long 64-bit integer


Use this keyword to specify a string with the output filename for the resulting data. If you set the keyword IN_MEMORY, you do not need to specify OUT_NAME.


Use this keyword to specify the output projection for the layer-stacked file. OUT_PROJ is a projection structure returned from ENVI_GET_PROJECTION or ENVI_PROJ_CREATE.


Use this keyword to specify the output x and y pixel size. OUT_PS is a two-element, double-precision array of the output x and y pixel sizes, respectively. OUT_PS has the same units specified in OUT_PROJ.


Use this keyword to specify an array of band positions, indicating the band numbers on which to perform the operation. POS is an array of long integers with one entry for each input file, with values ranging from 0 to the number of bands minus 1. The number of elements of POS and FID correspond to the number of input files to stack together, one entry for each file.


ENVI Classic library routines that result in new images also have an R_FID, or “returned FID.” This is simply a named variable containing the file ID to access the processed data. Specifying this keyword saves you the step of opening the new file from disk.

© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us