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 properties (Set, Get): GRID_DEFINITION, INPUT_RASTERS, OUTPUT_RASTER_URI, RESAMPLING
Output properties (Get only): OUTPUT_RASTER
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
Methods
This task inherits the following methods from ENVITask:
Properties
This task inherits the following properties from ENVITask:
This task also contains the following properties:
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.
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.
- If you set this property to an asterisk symbol (*), the output raster will be virtual and not written to disk.
- If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.
RESAMPLING (optional)
Specify the resampling method to use when creating the spatial grid:
Nearest Neighbor
(default): Uses the nearest pixel without any interpolation.Bilinear
: Performs a linear interpolation using four pixels to resample.Cubic Convolution
: Uses 16 pixels to approximate the sinc function using cubic polynomials to resample the image.
Version History
ENVI 5.5 |
Introduced |
API Version
4.2
See Also
ENVITask, ENVIGridDefinition, ENVILayerStackRaster, CalculateGridDefinitionFromRasterIntersection Task, CalculateGridDefinitionFromRasterUnion Task