BuildLayerStack Task

This task builds a layer-stacked raster from a set of rasters that will be reprojected and regridded to a common spatial grid. The input rasters do not need to have the same number of columns and rows.

This is different than using the BuildBandStack task, where the input rasters must have the same number of columns and rows and no reprojection or regridding will occur.

The virtual raster associated with this task is ENVILayerStackRaster.

Example

; Start the application

e = ENVI()

 

; Open a Sentinel-2 scene

file = 'S2A_OPER_MTD...xml' ; insert a real filename here

raster = e.OpenRaster(file)

 

; Get the 10-meter band group

bands10m = raster[0]

 

; Get the 20-meter band group

bands20m = raster[1]

 

; Use the spatial reference of the 10-meter

; raster to create a common grid definition

; for the 20-meter raster.

gridTask = ENVITask('BuildGridDefinitionFromRaster')

gridTask.INPUT_RASTER = bands10m

gridTask.Execute

 

; Create a layer Stack

Task = ENVITask('BuildLayerStack')

Task.INPUT_RASTERS = [bands10m, bands20m]

Task.GRID_DEFINITION = gridTask.OUTPUT_GRIDDEFINITION

Task.Execute

 

; Add the output to the data collection

e.Data.Add, Task.OUTPUT_RASTER

 

; Display the result

View = e.GetView()

Layer = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax

Result = ENVITask('BuildLayerStack')

Input parameters (Set, Get): GRID_DEFINITION, INPUT_RASTERS, ORDER_BANDS_BY_WAVELENGTH, OUTPUT_RASTER_URI, RESAMPLING

Output parameters (Get only): OUTPUT_RASTER

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters

GRID_DEFINITION (optional)

Specify an ENVIGridDefinition object that defines the pixel size, rows and columns, and coordinate system of the desired spatial reference. If this is not set, then an ENVIGridDefinition will be constructed from the first raster in INPUT_RASTERS.

INPUT_RASTERS (required)

Specify an array of rasters from which to build a layer-stacked raster.

ORDER_BANDS_BY_WAVELENGTH (optional)

Set if bands should be ordered by increasing wavelength value. This parameter is ignored if the rasters do not have wavelength metadata.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.

RESAMPLING (optional)

Specify the resampling method to use when creating the spatial grid:

Output Parameters

OUTPUT_RASTER

This is a reference to the output raster of filetype ENVI.

Methods

Execute

Parameter

ParameterNames

Properties

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History

ENVI 5.5

Introduced

ENVI 6.1

Added ORDER_BANDS_BY_WAVELENGTH parameter

See Also

ENVITask, ENVIGridDefinition, ENVILayerStackRaster, CalculateGridDefinitionFromRasterIntersection Task, CalculateGridDefinitionFromRasterUnion Task, Masking Support in ENVITasks